[Bug target/61997] New: cc1plus ICE with aarch64 target using PCH and builtin functions

2014-08-02 Thread rmorell at nvidia dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61997

Bug ID: 61997
   Summary: cc1plus ICE with aarch64 target using PCH and builtin
functions
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rmorell at nvidia dot com

Created attachment 33226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33226&action=edit
Test case

This reproduces with at least GCC 4.8.2, 4.8.3, and SVN r213491.  I believe
it's present in every version that supports the aarch64 target.

I have been using GCC configured with:
configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu
--target=aarch64-unknown-linux-gnu --enable-languages=c,c++
--enable-threads=posix --enable-shared --disable-libsanitizer
--disable-gnu-indirect-function --disable-gnu-unique-object
--with-sysroot=/gcc-debug/Linux-aarch64-sysroot --disable-multilib

The simplest reproduction case that I've found is to precompile a header with
exactle one line in it, call it precomp.h:
#define CEILF(f) ceilf(f)

Compile the PCH with:
aarch64-unknown-linux-gnu-gcc -nostdinc -march=armv8-a -fPIC -O2
-ftree-vectorize -x c++-header -c precomp.h -o precomp.h.ghc

Then build the attached longish creduce'd test case with:
aarch64-unknown-linux-gnu-gcc -nostdinc -march=armv8-a -fPIC -O2
-ftree-vectorize -x c++ -include precomp.h -Winvalid-pch -c test.c

It fails with SEGV:
test.c: In function ‘void x127()’:
test.c:141:1: internal compiler error: Segmentation fault
 x127 ()
 ^
0x899d958 crash_signal
/gcc-debug/gcc-svn/gcc/toplev.c:337
0x81bbd62 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
/gcc-debug/gcc-svn/gcc/tree.h:2841
0x87208ca gimple_build_call_1
/gcc-debug/gcc-svn/gcc/gimple.c:216
0x872093d gimple_build_call_vec(tree_node*, vec)
/gcc-debug/gcc-svn/gcc/gimple.c:230
0x8bd85e0 vectorizable_call
/gcc-debug/gcc-svn/gcc/tree-vect-stmts.c:2470
0x8be7b1f vect_transform_stmt(gimple_statement_base*, gimple_stmt_iterator*,
bool*, _slp_tree*, _slp_instance*)
/gcc-debug/gcc-svn/gcc/tree-vect-stmts.c:7237
0x8bfb143 vect_transform_loop(_loop_vec_info*)
/gcc-debug/gcc-svn/gcc/tree-vect-loop.c:6079
0x8c0e4f1 vectorize_loops()
/gcc-debug/gcc-svn/gcc/tree-vectorizer.c:478
0x8b1c75c execute
/gcc-debug/gcc-svn/gcc/tree-ssa-loop.c:232

It looks like the reason for the failure is that the global table
aarch64_builtin_decls in aarch64-builtins.c isn't relocated when loading the
PCH.  All of the nodes that it points to are freed, and the memory may get
reused (or poisoned, if that's enabled).

The table is properly annotated with the GTY macro, but aarch64-builtins.c
isn't in GTFILES so it's not processed by the type generator.

If I manually add aarch64-builtins.c to target_gtfiles (and include the
resulting gt-aarch64-builtins.h at the bottom of the C file) then this problem
goes away.

[Bug c++/49377] New: Template specialization attributes cause type mismatches when used

2011-06-11 Thread rmorell at nvidia dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49377

   Summary: Template specialization attributes cause type
mismatches when used
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: rmor...@nvidia.com


This is similar to PR 45642, but is not fixed by the patch for that bug.

I originally ran into this with 4.6.0, but I also see the behavior with a
freshly-updated and built svn gcc (revision 174959).

The reduced testcase is pretty simple:
---8<---
template  class v;

template  class v {
v() { };
} __attribute__((__may_alias__));

typedef v float2;

class a {
void f(float2 &point);
float2 d;
};

void a::f(float2 &point) { }
---8<---

No special compile options, the implementation of a::f isn't matched up with
the member:
$ g++ -c test.cpp
test.cpp:14:6: error: prototype for ‘void a::f(float2&)’ does not match any in
class ‘a’
test.cpp:10:10: error: candidate is: void a::f(float2&)
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/xbobx/src/gcc/install-174959/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/xbobx/src/gcc/install-174959/
--enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.7.0 20110611 (experimental) (GCC) 


If I remove the attribute on the template specialization _or_ the float2 data
field 'd', the test compiles fine.  The bug also occurs if "float2" is used in
other ways between the declaration of class a and the a::f definition (such as
in another class).