[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #22 from Rob 2011-01-05 16:26:43 UTC --- (In reply to comment #21) > At long last. It was only 2 years... I have some older than that. Thank you for your work on my Bug Report, Rob
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Eric Botcazou changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED Target Milestone|4.6.0 |4.4.6 --- Comment #21 from Eric Botcazou 2011-01-04 23:20:15 UTC --- At long last.
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #19 from Eric Botcazou 2011-01-04 23:18:32 UTC --- Author: ebotcazou Date: Tue Jan 4 23:18:29 2011 New Revision: 168491 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168491 Log: PR preprocessor/39213 * directives.c (end_directive): Call _cpp_remove_overlay for deferred pragmas as well in traditional mode. Modified: branches/gcc-4_5-branch/libcpp/ChangeLog branches/gcc-4_5-branch/libcpp/directives.c
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #20 from Eric Botcazou 2011-01-04 23:18:55 UTC --- Author: ebotcazou Date: Tue Jan 4 23:18:52 2011 New Revision: 168492 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168492 Log: PR preprocessor/39213 * directives.c (end_directive): Call _cpp_remove_overlay for deferred pragmas as well in traditional mode. Modified: branches/gcc-4_4-branch/libcpp/ChangeLog branches/gcc-4_4-branch/libcpp/directives.c
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #18 from Eric Botcazou 2011-01-04 23:18:15 UTC --- Author: ebotcazou Date: Tue Jan 4 23:18:12 2011 New Revision: 168490 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168490 Log: PR preprocessor/39213 * directives.c (end_directive): Call _cpp_remove_overlay for deferred pragmas as well in traditional mode. Modified: trunk/libcpp/ChangeLog trunk/libcpp/directives.c
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Eric Botcazou changed: What|Removed |Added Attachment #22795|0 |1 is obsolete|| --- Comment #17 from Eric Botcazou 2010-12-18 17:37:27 UTC --- Created attachment 22812 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22812 Revised patch It passes the cpp.exp and trad.exp testsuites on 2 platforms.
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #16 from Eric Botcazou 2010-12-18 17:35:48 UTC --- > I wonder if this wouldn't fix it (at least, that's similar to how lex.c guards > calling of _cpp_process_line_notes). I can't reproduce it myself, so have to > guess... The problem is that #pragma redefine_extname breaks the balance of calls to _cpp_overlay_buffer and _cpp_remove_overlay: Breakpoint 1, _cpp_overlay_buffer (pfile=0x104705160, start=0x104714050 " redefine_extname\tmkstemp64\tmkstemp\nE64_SOURCE)\nLONG)\n& (3 - 0 >= 4))\nNned(_XOPEN_SOURCE)) || \t\tdefined(_KERNEL) || defined(_KMEMUSER) || \t\tdefined(__EXTENSIONS__)\n", len=35) at /nile.build/botcazou/gcc-head/src/libcpp/traditional.c:269 269 cpp_buffer *buffer = pfile->buffer; (gdb) p pfile->overlaid_buffer $3 = (cpp_buffer *) 0x0 (gdb) continue Continuing. Breakpoint 1, _cpp_overlay_buffer (pfile=0x104705160, start=0x104714050 "\t \nseemp64\tmkstemp\nkstemp64\tmkstemp\nE64_SOURCE)\nLONG)\n& (3 - 0 >= 4))\nNned(_XOPEN_SOURCE)) || \t\tdefined(_KERNEL) || defined(_KMEMUSER) || \t\tdefined(__EXTENSIONS__)\n", len=2) at /nile.build/botcazou/gcc-head/src/libcpp/traditional.c:269 269 cpp_buffer *buffer = pfile->buffer; (gdb) p pfile->overlaid_buffer $4 = (cpp_buffer *) 0x10470ad98 because in_deferred_pragma is true in: /* Called when leaving a directive, _Pragma or command-line directive. */ static void end_directive (cpp_reader *pfile, int skip_line) { if (pfile->state.in_deferred_pragma) ; else if (CPP_OPTION (pfile, traditional)) { /* Revert change of prepare_directive_trad. */ pfile->state.prevent_expansion--; if (pfile->directive != &dtable[T_DEFINE]) _cpp_remove_overlay (pfile); } It is only reset to false in _cpp_lex_direct but this is apparently too late to call _cpp_remove_overlay from there: Index: lex.c === --- lex.c (revision 167901) +++ lex.c (working copy) @@ -1944,6 +1944,8 @@ _cpp_lex_direct (cpp_reader *pfile) pfile->state.in_deferred_pragma = false; if (!pfile->state.pragma_allow_expansion) pfile->state.prevent_expansion--; + if (CPP_OPTION (pfile, traditional)) + _cpp_remove_overlay (pfile); return result; } if (!_cpp_get_fresh_line (pfile)) yields a SIGSEGV in _cpp_remove_overlay. The obvious change to end_directive seems to work though, revised patch to be attached.
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #14 from Jakub Jelinek 2010-12-17 10:46:09 UTC --- Created attachment 22795 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22795 gcc46-pr39213.patch I wonder if this wouldn't fix it (at least, that's similar to how lex.c guards calling of _cpp_process_line_notes). I can't reproduce it myself, so have to guess...
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Eric Botcazou changed: What|Removed |Added CC||tromey at gcc dot gnu.org --- Comment #13 from Eric Botcazou 2010-11-29 08:41:06 UTC --- Tom, what's the best approach to fixing this?
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Eric Botcazou changed: What|Removed |Added CC||tromey at redhat dot com --- Comment #12 from Eric Botcazou 2010-11-24 12:35:18 UTC --- add_line_note adds a sentinel note done: *d = '\n'; /* A sentinel note that should never be processed. */ add_line_note (buffer, d + 1, '\n'); buffer->next_line = s + 1; then _cpp_overlay_buffer changes buffer->cur and the test at the beginning of _cpp_process_line_notes if (note->pos > buffer->cur) break; then becomes totally bogus. I guess _cpp_overlay_buffer/_cpp_remove_overlay must temporarily invalidate the notes somehow.
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 --- Comment #11 from Eric Botcazou 2010-11-24 11:44:22 UTC --- Backtrace with Rainer's testcase on SPARC/Solaris 32-bit: Program received signal SIGABRT, Aborted. 0xff3201cc in _libc_kill () from /usr/lib/libc.so.1 (gdb) bt #0 0xff3201cc in _libc_kill () from /usr/lib/libc.so.1 #1 0xff2b594c in abort () from /usr/lib/libc.so.1 #2 0x008607d8 in _cpp_process_line_notes (pfile=0xaa3568, in_comment=0) at /nile.build/botcazou/gcc-head/src/libcpp/lex.c:871 #3 0x00869370 in _cpp_scan_out_logical_line (pfile=0xaa3568, macro=0x0) at /nile.build/botcazou/gcc-head/src/libcpp/traditional.c:384 #4 0x00869fb4 in _cpp_read_logical_line_trad (pfile=0xaa3568) at /nile.build/botcazou/gcc-head/src/libcpp/traditional.c:306 #5 0x0010aef0 in scan_translation_unit_trad (pfile=0xaa3568) at /nile.build/botcazou/gcc-head/src/gcc/c-family/c-ppoutput.c:288 #6 preprocess_file (pfile=0xaa3568) at /nile.build/botcazou/gcc-head/src/gcc/c-family/c-ppoutput.c:94 #7 0x00107618 in c_common_init () at /nile.build/botcazou/gcc-head/src/gcc/c-family/c-opts.c:1051 #8 0x000ae7c4 in c_objc_common_init () at /nile.build/botcazou/gcc-head/src/gcc/c-objc-common.c:64 #9 0x00481bb0 in lang_dependent_init (argc=5, argv=0xffbefbcc) at /nile.build/botcazou/gcc-head/src/gcc/toplev.c:2184 #10 do_compile (argc=5, argv=0xffbefbcc) at /nile.build/botcazou/gcc-head/src/gcc/toplev.c:2315
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot ||gnu.org --- Comment #10 from Eric Botcazou 2010-11-22 22:46:02 UTC --- It also fails with the 64-bit compiler on SPARC/Solaris, not just -m64.
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213 Richard Guenther changed: What|Removed |Added Priority|P3 |P2 Known to fail||
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #9 from rob1weld at aol dot com 2010-07-14 17:27 --- Thanks for working on this guys, Rob -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #8 from ro at CeBiTec dot Uni-Bielefeld dot DE 2010-06-25 16:48 --- Subject: Re: [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp It occured to me that this is only failing for me with 32-bit cc1, i.e. i386-pc-solaris2.11, sparc-sun-solaris2.11, mips-sgi-irix6.5, but not alpha-dec-osf5.1 (which is 64-bit). Rainer -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld dot DE 2010-06-24 13:50 --- Subject: Re: [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp > --- Comment #6 from jakub at gcc dot gnu dot org 2010-06-24 12:56 --- > Can't reproduce on x86_64-linux (and, #pragma redefine_extname seems to be > handled on all targets, not just Solaris). This seems to be extremely sensitive to command line parameters. E.g. on mips-sgi-irix6.5 it works (no ICE) with $ cc1 -E -tditional-cpp include.c -o include.i -I . When I add either -mabi=n32 or -mabi=64, cc1 aborts. Similarly, on sparc-sun-solaris2.11: $ cc1 -E -traditional-cpp include.c -o include.i -I . ICEs $ cc1 -E -traditional-cpp `pwd`/include.c -o include.i -I . works. Rainer -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #6 from jakub at gcc dot gnu dot org 2010-06-24 12:56 --- Can't reproduce on x86_64-linux (and, #pragma redefine_extname seems to be handled on all targets, not just Solaris). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #5 from ro at CeBiTec dot Uni-Bielefeld dot DE 2010-06-24 12:20 --- Subject: Re: [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp > --- Comment #4 from jakub at gcc dot gnu dot org 2010-06-24 11:51 --- > created. But, as this PR lacks a testcase (well, the testcase depends on a > proprietary header file not included here), it is hard to guess what's going > on. I could include the OpenSolaris header, which is licensed under CDDL, but I've just been able to construct a minimal testcase: $ cat include.c #include $ cat stdlib.h #pragma redefine_extnamemkstemp64 mkstemp $ ./cc1 -E -traditional-cpp ./include.c -o include.i -I . -m64 In file included from ./include.c:2:0: ./stdlib.h:1:0: internal compiler error: Abort This should make it easier to find what's going on. Unlike the original test case from the GCC testsuite, this one fails even without -m64. Rainer -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #4 from jakub at gcc dot gnu dot org 2010-06-24 11:51 --- note->type == 10 is: *d = '\n'; /* A sentinel note that should never be processed. */ add_line_note (buffer, d + 1, '\n'); buffer->next_line = s + 1; created. But, as this PR lacks a testcase (well, the testcase depends on a proprietary header file not included here), it is hard to guess what's going on. Can you see if doing just cp /usr/include/stdlib.h /tmp/stdlib.h gcc -E -traditional-cpp /tmp/stdlib.h If yes, can you distill a smaller testcase from it (ideally at most a few lines)? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213
[Bug preprocessor/39213] [4.4/4.5/4.6 regression] Preprocessor ICE with -m64 and --traditional-cpp
--- Comment #3 from ro at gcc dot gnu dot org 2010-06-21 12:35 --- Updated summary (you list the regressed branches to fix, not the working one). -- ro at gcc dot gnu dot org changed: What|Removed |Added Known to fail|4.4.0 4.5.0 |4.4.5 4.5.1 4.6.0 Known to work|3.4.3 |3.4.6 Summary|Regression [3.4.3] |[4.4/4.5/4.6 regression] |Preprocessor ICE with -m64 |Preprocessor ICE with -m64 |and --traditional-cpp |and --traditional-cpp Target Milestone|--- |4.6.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39213