[Bug ipa/93223] New: Segmentation fault in ipa-cp.c

2020-01-10 Thread christoph.hoeger at celeraone dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93223

Bug ID: 93223
   Summary: Segmentation fault in ipa-cp.c
   Product: gcc
   Version: 9.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christoph.hoeger at celeraone dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 47629
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47629&action=edit
test

The following crash occurs under a specific combination of anonymous namespace,
disabled optimizations and the usage of function pointers with -O3 :

gcc_bug g++ -O3 -c demo.cpp
during IPA pass: cp
/tmp/test.cpp:59:1: internal compiler error: Segmentation fault
   59 | }
  | ^
0x8cdeef ???
../../gcc/toplev.c:327
0x15ab641 ???
../../gcc/ipa-cp.c:2570
0x15ad6ad ???
../../gcc/ipa-cp.c:2828
0x15aa364 ???
../../gcc/ipa-cp.c:3025
0x15a827d ???
../../gcc/ipa-cp.c:3196
0x1163fc6 ???
../../gcc/passes.c:2508
0x14da21a ???
../../gcc/passes.c:2948
0x1472bf7 ???
../../gcc/cgraphunit.c:2542
0x10157d4 ???
../../gcc/cgraphunit.c:2865
0x14e804f ???
../../gcc/toplev.c:482
0xec7947 ???
../../gcc/toplev.c:2206
0xec9a5f ???
../../gcc/main.c:39
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccwnkWOK.out file, please attach this to
your bugreport.


See attached file demo.cpp for reproduction.

According to godbolt, the issue persists in trunk:

https://godbolt.org/z/T_NMPf

Please note the suspicuous line here:

https://github.com/gcc-mirror/gcc/blob/gcc-9_2_0-release/gcc/ipa-cp.c#L2569

it looks like the result of ipa_fn_summaries->get (callee); should be checked
for nullptr.

Also, the issue is rather hard to trigger as it seems to depend on heuristic
optimizations.

[Bug c++/91023] New: Unification Fails for parameter pack

2019-06-27 Thread christoph.hoeger at celeraone dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91023

Bug ID: 91023
   Summary: Unification Fails for parameter pack
   Product: gcc
   Version: 9.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christoph.hoeger at celeraone dot com
  Target Milestone: ---

Created attachment 46529
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46529&action=edit
Automatically generated preprocessed output

In the example below, the unification of the template argument fails with the
message:

➜  gcc.bug g++ --std=c++17 input.cpp
input.cpp: In substitution of 'template
std::optional > parse_variant(const Foo >& ...) [with T = ]':
input.cpp:33:43:   required from here
input.cpp:33:43: internal compiler error: in tsubst, at cp/pt.c:14560
   33 | const auto x =  parse_variant(a(), b());
  |   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc1jpH2s.out file, please attach this to
your bugreport.
distcc[31035] ERROR: compile input.cpp on localhost failed


Example:



#include 
#include 

template 
struct Foo
{
};

template 
std::optional>
parse_variant(const Foo> &... variants)
{
return {};
}

struct A {};
struct B {};

using var_test = std::variant;

Foo a()
{
return {};
}

Foo b()
{
return {};
}

int main()
{
const auto x =  parse_variant(a(), b());
return 0;
}


gcc version information:

➜  gcc.bug g++ -v 
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC)

[Bug c++/91023] Unification Fails for parameter pack

2019-06-27 Thread christoph.hoeger at celeraone dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91023

--- Comment #1 from Christoph Höger  ---
Since it might help investigating the issue, here is a workaround:


#include 
#include 

template 
struct Foo
{
};

template 
std::optional>
parse_variant(const Foo &... variants)
{
return {};
}

struct A {};
struct B {};

using var_test = std::variant;

Foo a()
{
return {};
}

Foo b()
{
return {};
}

int main()
{
const auto x =  parse_variant(a(), b());
return 0;
}

[Bug bootstrap/101245] New: Bootstrap fails for a combined tree with --enable-shared

2021-06-28 Thread christoph.hoeger at celeraone dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101245

Bug ID: 101245
   Summary: Bootstrap fails for a combined tree with
--enable-shared
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christoph.hoeger at celeraone dot com
  Target Milestone: ---

Created attachment 51075
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51075&action=edit
Reproduction build script

I tried to bootstrap gcc 11.1.0 with binutils 2.36.1 in a combined tree and the
build fails in stage2 when building libiberty.

The failure stems from as not finding its shared libraries (opcode and bfd).
The RPATH is set wrong:

➜  test2 readelf -d build/prev-gas/.libs/lt-as-new | grep RPATH
 0x000f (RPATH)  Library rpath:
[/home/choeger/c1/scratch/gcc-combined/test2/build/opcodes/.libs:/home/choeger/c1/scratch/gcc-combined/test2/build/bfd/.libs:/usr/local/lib]
➜  test2

As you can see, the RPATH is not reset to the prev- directories.

➜  test2 build/prev-gas/as-new 
/home/choeger/c1/scratch/gcc-combined/test2/build/prev-gas/.libs/lt-as-new:
error while loading shared libraries: libopcodes-2.36.1.so: cannot open shared
object file: No such file or directory

Find attached a script to reproduce the issue.