[Bug regression/93009] AVX512 FMA - wrong code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93009 Matthias Hochsteger changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #5 from Matthias Hochsteger --- Thanks for the fast replies. Anyway, I think there was a misunderstanding. The issue is not about accuracy of fma vs. mult+add. The attached code should clarify the issue (I still couldn't simplify it much though). It basically boils down to a single call of multiplyAndAdd: template T multiplyAndAdd(T a, T b, T c) { return a*b+c; } template __attribute__ ((__always_inline__)) inline S P1(S x) const { cout << "a = " << S(coefsal[1][0]) << endl; cout << "b = " << S(x) << endl; cout << "c = " << S(coefsal[1][1]) << endl; auto res = multiplyAndAdd (S(coefsal[1][0]),S(x),S(coefsal[1][1])); cout << "res: " << res << endl; return res; } The data type is "AutoDiffRec<3, SIMD>", which basically contains 4 _m128d values. >$ g++ -std=c++17 -march=skylake-avx512 -O1 test_fma.ii && ./a.out > a = 1 1, D = 0 0 0 0 0 0 > b = 3 4, D = 0 0 0 0 0 0 > c = 2 2, D = 0 0 0 0 0 0 > res: 5 6, D = 0 0 0 0 0 0 >$ g++ -std=c++17 -march=skylake-avx512 -O1 -fexpensive-optimizations >test_fma.ii && ./a.out > a = 1 1, D = 0 0 0 0 0 0 > b = 3 4, D = 0 0 0 0 0 0 > c = 2 2, D = 0 0 0 0 0 0 > res: 3 3, D = 0 0 0 0 0 0
[Bug regression/93009] AVX512 FMA - wrong code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93009 --- Comment #4 from Matthias Hochsteger --- Created attachment 47534 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47534=edit new code, cout results
[Bug regression/93009] New: AVX512 FMA - wrong code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93009 Bug ID: 93009 Summary: AVX512 FMA - wrong code generation Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- Created attachment 47526 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47526=edit preprocessed code Hello, gcc 9.2 produces wrong output when compiling for AVX512 targets, depending on the optimization level. The preprocessed source file is attached. Correct output: > g++ -std=c++17 -march=skylake-avx512 -O1 test_fma.ii > g++ -std=c++17 -march=skylake-avx512 -O2 -fno-expensive-optimizations > test_fma.ii > 7.95851e-06 Wrong output: > g++ -std=c++17 -march=skylake-avx512 -O1 -fexpensive-optimizations test_fma.ii > g++ -std=c++17 -march=skylake-avx512 -O2 test_fma.ii > 1e-10 All four cases work if the (non-preprocessed) source file is compiled with gcc 8.3, or the target is "skylake" instead of "skylake-avx512". gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto gdc_include_dir=/usr/include/dlang/gdc Thread model: posix gcc version 9.2.0 (GCC) Best, Matthias
[Bug c++/84091] [8 Regression] ICE on valid C++ code: Segmentation fault
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84091 Matthias Hochsteger changed: What|Removed |Added CC||matthias.hochsteger@tuwien. ||ac.at --- Comment #1 from Matthias Hochsteger --- Introduced with commit fa01d4a50ef3115a509c67af897c854001597ea7 (HEAD) Author: jasonDate: Fri Jan 26 15:25:23 2018 + PR c++/82514 - ICE with local class in generic lambda. * pt.c (regenerated_lambda_fn_p): Remove. (enclosing_instantiation_of): Don't use it. (tsubst_function_decl): Call enclosing_instantiation_of. * pt.c (lookup_template_class_1): Add sanity check. * name-lookup.c (do_pushtag): Don't add closures to local_classes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257093 138bc75d-0d04-0410-961f-82ee72b054a4
[Bug c++/82148] ICE in assign_temp, at function.c:968
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82148 --- Comment #1 from Matthias Hochsteger --- Same on latest trunk (git commit 520b78be6e5b448ae4341960acc5706ae561c974): ~/local/gcc7/bin/c++ -v -save-temps -std=c++17 -c code.cpp Using built-in specs. COLLECT_GCC=/home/matthias/local/gcc7/bin/c++ Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/home/matthias/local/gcc7 --enable-languages=c,c++ --disable-multilib Thread model: posix gcc version 8.0.0 20170908 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++1z' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /home/matthias/local/gcc7/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/cc1plus -E -quiet -v -D_GNU_SOURCE code.cpp -mtune=generic -march=x86-64 -std=c++1z -fpch-preprocess -o code.ii ignoring nonexistent directory "/home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/../../../../include/c++/8.0.0 /home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/../../../../include/c++/8.0.0/x86_64-pc-linux-gnu /home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/../../../../include/c++/8.0.0/backward /home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/include /usr/local/include /home/matthias/local/gcc7/include /home/matthias/local/gcc7/lib/gcc/x86_64-pc-linux-gnu/8.0.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++1z' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /home/matthias/local/gcc7/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/cc1plus -fpreprocessed code.ii -quiet -dumpbase code.cpp -mtune=generic -march=x86-64 -auxbase code -std=c++1z -version -o code.s GNU C++14 (GCC) version 8.0.0 20170908 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 8.0.0 20170908 (experimental), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++14 (GCC) version 8.0.0 20170908 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 8.0.0 20170908 (experimental), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 34f3776a4b4b0480fb19303c453a2e50 during RTL pass: expand code.cpp: In function ‘void bar()’: code.cpp:17:8: internal compiler error: in assign_temp, at function.c:970 foo(Derived{0}); ~~~^~~~ 0x6cef41 assign_temp(tree_node*, int, int) ../../gcc/function.c:970 0xb80dd3 initialize_argument_information ../../gcc/calls.c:1830 0xb818df expand_call(tree_node*, rtx_def*, int) ../../gcc/calls.c:3279 0xc8ea1d expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/expr.c:10860 0xb957e0 expand_expr ../../gcc/expr.h:276 0xb957e0 expand_call_stmt ../../gcc/cfgexpand.c:2666 0xb957e0 expand_gimple_stmt_1 ../../gcc/cfgexpand.c:3585 0xb957e0 expand_gimple_stmt ../../gcc/cfgexpand.c:3751 0xb96721 expand_gimple_basic_block ../../gcc/cfgexpand.c:5750 0xb9b12e execute ../../gcc/cfgexpand.c:6357
[Bug c++/82148] New: ICE in assign_temp, at function.c:968
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82148 Bug ID: 82148 Summary: ICE in assign_temp, at function.c:968 Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- Created attachment 42141 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42141=edit Preprocessed source file The code below fails to compile with -std=c++17, but compiles with -std=c++14. A work-around is to add a constructor to 'Base'. The code (code.ii is attached): /// #include struct Base { // Working with the follwing line // ~Base() {} }; struct Derived : public Base { Derived (std::initializer_list list) { } ~Derived() { } }; void foo(Base a) { } void bar() { foo(Derived{0}); } /// The compiler call: > c++ -v -save-temps -std=c++17 -c code.cpp Using built-in specs. COLLECT_GCC=c++ Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp Thread model: posix gcc version 7.2.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++1z' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1plus -E -quiet -v -D_GNU_SOURCE code.cpp -mtune=generic -march=x86-64 -std=c++1z -fpch-preprocess -o code.ii ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/x86_64-pc-linux-gnu /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/backward /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++1z' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1plus -fpreprocessed code.ii -quiet -dumpbase code.cpp -mtune=generic -march=x86-64 -auxbase code -std=c++1z -version -o code.s GNU C++14 (GCC) version 7.2.0 (x86_64-pc-linux-gnu) compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++14 (GCC) version 7.2.0 (x86_64-pc-linux-gnu) compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: f3b185e2b85ecd352b4699fa98d9eb0f code.cpp: In function ‘void bar()’: code.cpp:17:8: internal compiler error: in assign_temp, at function.c:968 foo(Derived{0}); ~~~^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions. Thanks, Matthias
[Bug tree-optimization/70499] internal compiler error: in make_ssa_name_fn, at tree-ssanames.c:266
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70499 --- Comment #6 from Matthias Hochsteger --- Oh, now I get it, sorry for the misunderstanding.
[Bug tree-optimization/70499] internal compiler error: in make_ssa_name_fn, at tree-ssanames.c:266
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70499 --- Comment #4 from Matthias Hochsteger --- This testcase is just a very striped-down version of the actual code to reproduce the error, so it may seem useless at some spots, like the missing initialization. We already have a workaround by adding additional __attribute__((__always_inline__)) to the methods of SIMD, in this sense it's no critical bug. This code is part of a cross-platform project. We are including immintrin.h since it is supplied by all used compilers. I am not sure how typedef double v4df __attribute__((vector_size (32))); behaves on others, but we will give it a try. Thanks, Matthias
[Bug c++/70499] New: internal compiler error: in make_ssa_name_fn, at tree-ssanames.c:266
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70499 Bug ID: 70499 Summary: internal compiler error: in make_ssa_name_fn, at tree-ssanames.c:266 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- The compiler crashes with the given code. Multiple (in fact probably all) versions are affected. Tested versions are 4.7, 4.8, 4.9, 5.1, 5.3 and 6.0 (4.6 and earlier don't accept -mavx2). Exact versions and abort messages are given below. Thanks! The code: // #include struct SIMD { __m256d data; SIMD() {}; SIMD (double val) { } SIMD(__m256d _data) { data = _data; } SIMD operator* (SIMD a) { return a; } }; struct Foo { SIMD val; SIMD dval[2]; __attribute__((__always_inline__)) SIMD & Value() throw() { return val; } __attribute__((__always_inline__)) Foo operator* ( const Foo & y) throw() { Foo res; SIMD hx; SIMD hy; res.Value() = hx*hy; res.dval[0] = hx*hy; return res; } }; template __attribute__((__always_inline__)) void inlineFunc(Tx hx[]) { Tx x = hx[0], y = hx[1]; Tx lam[1] = (x*y); } void FooBarFunc () { Foo adp[2]; inlineFunc (adp); } // Abort messages: = g++-4.7 -v Using built-in specs. COLLECT_GCC=g++-4.7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-12ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) g++-4.7 -mavx2 -O2 -c simd.cpp simd.cpp:27:41: warning: always_inline function might not be inlinable [-Wattributes] simd.cpp: In function ‘void inlineFunc(Tx*) [with Tx = Foo]’: simd.cpp:35:1: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Preprocessed source stored into /tmp/cc7UN6UV.out file, please attach this to your bugreport. ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/_usr_lib_gcc_x86_64-linux-gnu_4.7_cc1plus.1028.crash' = g++-4.8 -v Using built-in specs. COLLECT_GCC=g++-4.8 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) g++-4.8 -mavx2 -O2 -c simd.cpp simd.cpp:27:41: warning: always_inline function might not be inlinable [-Wattributes] __attribute__((__always_inline__)) void inlineFunc(Tx hx[]) { ^ simd.cpp: In function ‘void Fo
[Bug c++/70271] New: internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70271 Bug ID: 70271 Summary: internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- The compiler crashes when creating debug symbols for the given code. command line: g++ -c -g testfile.cpp compiler version: g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/matthias/local/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/usr --disable-multilib --disable-bootstrap --with-system-zlib --prefix=/home/matthias/local --enable-languages=c,c++,lto --no-create --no-recursion Thread model: posix gcc version 6.0.0 20160317 (experimental) (GCC) /// Utility functions to convert capture-less lambdas to function pointers template struct function_traits : public function_traits<decltype(::operator())> { }; template struct function_traits<ReturnType(ClassType::*)(Args...) const> { typedef ReturnType (*pointer)(Args...); typedef ReturnType return_type; }; template typename function_traits::pointer FunctionPointer (const Function& lambda) { return static_cast::pointer>(lambda); } template typename function_traits::return_type GetReturnValue (Function func) { typename function_traits::return_type *dummy; return *dummy; } template class ClassFoo {}; template void FuncBar () { } template <> inline void FuncBar () { typedef void (*func_type)(ClassFoo &); // this code fails with // internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346 // 0x9ec27b dwarf2out_finish // ../../gcc/dwarf2out.c:27346 func_type f1 = FunctionPointer ([](ClassFoo & ref) { }); // this code is working fine // func_type f2 = static_cast([](ClassFoo & self) { }); }
[Bug debug/70271] [6 Regression] internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70271 --- Comment #2 from Matthias Hochsteger --- Looks like the following commit introduced this behavior: commit b309adc8ef90cd7c7ecc46124707a51a53cfb205 Author: rguenthDate: Fri Sep 18 12:59:32 2015 + 2015-09-18 Richard Biener * dwarf2out.c (append_entry_to_tmpl_value_parm_die_table): Assert we're in early phase. (schedule_generic_params_dies_gen): Likewise. (gen_remaining_tmpl_value_param_die_attribute): Do only as much work as possible, retaining unhandled cases. (gen_scheduled_generic_parms_dies): Set early-dwarf flag and clear out generic_type_instances at the end. (dwarf2out_finish): Move call to gen_scheduled_generic_parms_dies... (dwarf2out_early_finish): ... here. Do most of gen_remaining_tmpl_value_param_die_attribute here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227905 138bc75d-0d04-0410-961f-82ee72b054a4
[Bug c++/64487] New: internal compiler error: in fold_offsetof_1, at c-family/c-common.c:9857
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64487 Bug ID: 64487 Summary: internal compiler error: in fold_offsetof_1, at c-family/c-common.c:9857 Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at The C++ file: #include stddef.h struct foo { int member; }; template int N struct bar {}; template int N struct qux { static barN+offsetof(foo,member) static_member; }; template int N barN+offsetof(foo,member) quxN::static_member; int main() { } g++ -c foo.cpp Error message: foo.cpp:16:6: internal compiler error: in fold_offsetof_1, at c-family/c-common.c:9857 The code compiles with GCC 4.4.7, but fails to compile with all other tested versions (4.6, 4.7, 4.8, 4.9, 5.0). Tested versions: - GCC 4.4.7 = Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.7-8ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --disable-libmudflap --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-8ubuntu1) - GCC 4.6.4 = Using built-in specs. COLLECT_GCC=g++-4.6 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.4-6ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-gnu-unique-object --disable-libmudflap --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-6ubuntu2) - GCC 4.7.4 = Using built-in specs. COLLECT_GCC=g++-4.7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.4-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1) - GCC 4.8.3 = Using built-in specs. COLLECT_GCC=g++-4.8 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.3-12ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr