This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: ICE in cpp with
>>>>> Neil Booth writes:
Hi Neil,
thanks for your answer.
> Hi Andreas,
> I'd like to help you fix this - it's my code - but I can't reproduce
> it with that input on my Linux box. Could you trim the command line
> as short as possible, maybe to just the -A asserts, so that it still
> happens. Then send me the command line.
> Alternatively, if you could tell me which line in _cpp_parse_assertion
> it's failing on, and the contents of some variables at that point
> (e.g. token) it would help a *lot*. (so at least we know which -A
> option it's barfing on).
The first problem I have is that running from the commandline doesn't work:
$ ./cpp -lang-c -v -iprefix ./../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/ -isystem ./include -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -DMIPSEL -D_MIPSEL -Dunix -Dmips -D_mips -DR3000 -D_R3000 -Dlinux -D__ELF__ -D__PIC__ -D__pic__ -D__MIPSEL__ -D_MIPSEL -D__unix__ -D__mips__ -D__mips__ -D__R3000__ -D_R3000 -D__linux__ -D__ELF__ -D__PIC__ -D__pic__ -D__MIPSEL -D__unix -D__mips -D__mips -D__R3000 -D__linux -Asystem\(posix\) -Acpu\(mips\) -Amachine\(mips\) -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2 -D_MIPS_SIM=_ABIN32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 -U__mips -D__mips -U__mips64 -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/include tmp-dum.c /tmp/ccdgD2mr.i
GNU CPP version 2.96 20000704 (experimental) (cpplib)
(MIPSel GNU/ELF)
ignoring nonexistent directory "/opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include"
cpp: Too many arguments. Type cpp --help for usage info
Ok, trimming the command line helps to reproduce this:
(gdb) r -lang-c -v -iprefix ./../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/ -isystem ./include -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include -Asystem\(posix\) -Acpu\(mips\) -Amachine\(mips\) -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/include tmp-dum.c /tmp/ccdgD2mr.i
Starting program: /home/sites/home/users/aj/builds/gcc/gcc/./cpp -lang-c -v -iprefix ./../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/ -isystem ./include -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include -Asystem\(posix\) -Acpu\(mips\) -Amachine\(mips\) -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/include tmp-dum.c /tmp/ccdgD2mr.i
Breakpoint 1 at 0x2aae10d4: file exit.c, line 40.
GNU CPP version 2.96 20000704 (experimental) (cpplib)
(MIPSel GNU/ELF)
ignoring nonexistent directory "/opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include"
ignoring nonexistent directory "../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/include"
ignoring nonexistent directory "../mipsel-unknown-linux-gnu/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory "/opt/gcc-2.96/mipsel-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
include
/opt/gcc-2.96/mipsel-unknown-linux-gnu/include
/opt/gcc-2.96/lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/include
/usr/include
End of search list.
Program received signal SIGSEGV, Segmentation fault.
warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x282ab138
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable). In that case, you may wish to
increase the size of the search with the `set heuristic-fence-post' command.
Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
0x282ab138 in ?? ()
(gdb) bt
#0 0x282ab138 in ?? ()
#1 0x41535c in _cpp_parse_assertion (pfile=0x10032a40, answerp=0x7ffffb40) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1331
#2 0x4154b8 in do_assert (pfile=0x10032a40) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1364
#3 0x41121c in _cpp_run_directive (pfile=0x10032a40, dir=0x10032580, buf=0x8 <Address 0x8 out of bounds>, count=3) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplex.c:3352
#4 0x4159f4 in cpp_assert (pfile=0x10032a40, str=0x7ffffe0b "machine(mips)") at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1487
#5 0x408dd8 in cpp_start_read (pfile=0x10032a40, print=0x10032b50, fname=0x7ffffe7b "tmp-dum.c") at /home/sites/home/users/aj/cvs/gcc/gcc/cppinit.c:966
#6 0x406a04 in main (argc=19, argv=0x10032b50) at /home/sites/home/users/aj/cvs/gcc/gcc/cppmain.c:73
(gdb) up
#1 0x41535c in _cpp_parse_assertion (pfile=0x10032a40, answerp=0x7ffffb40) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1331
1331 return cpp_lookup (pfile, sym, len);
(gdb) p pfile
$1 = (cpp_reader *) 0x10032a40
(gdb) p sym
$2 = (U_CHAR *) 0x7ffffae0 "#machinem¦\003\020xøÿ\177`\202\003\0208X\003\020@*\003\020@*\003\020ÿÿÿÿ{þÿ\177\001"
(gdb) p token
$3 = (cpp_token *) 0x7ffffae0
(gdb) p *token
$4 = {line = 1667329315, col = 26984, type = 110, flags = 101 'e', val = {integer = 9179861474720589421, name = {len = 268674669,
text = 0x7ffff878 "\004§¸\017 \221¸\017Ķ¶\017Àøÿ\177ø¶¶\017ð\020¶\017@p¼*"}, aux = 268674669}}
(gdb) p *pfile
$5 = {printer = 0x10032b50, buffer = 0x10032ce8, token_buffer = 0x10032b70 "/usr/share/locale", token_buffer_size = 200, limit = 0x10032b70 "/usr/share/locale", errors = 0,
multiline_string_line = 0, multiline_string_column = 0, system_include_depth = 0, buffer_stack_depth = 2, include_depth = 1, hashtab = 0x10033ca0,
all_include_files = 0x100354c8, actual_dirs = 0x10036f68, max_include_len = 63, potential_control_macro = 0x0, col_adjust = 0, token_list = {tokens = 0x10035838,
tokens_used = 5, tokens_cap = 256, namebuf = 0x10036840 "machinemips)__int\nJMP__1\n(experimental)\"", name_used = 11, name_cap = 1024, directive = 0x0, file = 0x0,
line = 0, params_len = 0, paramc = 0, flags = 5}, temp_tokens = 0x0, temp_cap = 0, temp_alloced = 0, temp_used = 0, date = 0x0, time = 0x0,
first_directive_token = 0x10035838, context_cap = 20, cur_context = 0, no_expand_level = 0, paste_level = 0, contexts = 0x10035690, args = 0x0, deps = 0x0,
hash_ob = 0x100344a8, buffer_ob = 0x10032c80, opts = {in_fname = 0x7ffffe7b "tmp-dum.c", out_fname = 0x7ffffe85 "/tmp/ccdgD2mr.i", tabstop = 8, pending = 0x10032c40,
deps_file = 0x0, deps_target = 0x0, quote_include = 0x100354f0, bracket_include = 0x100354f0, map_list = 0x0,
include_prefix = 0x7ffffd6e "./../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/", include_prefix_len = 47, verbose = 1 '\001', cplusplus = 0 '\000',
cplusplus_comments = 1 '\001', objc = 0 '\000', lang_asm = 0 '\000', lang_fortran = 0 '\000', chill = 0 '\000', discard_comments = 1 '\001', trigraphs = 0 '\000',
print_deps = 0 '\000', print_deps_missing_files = 0 '\000', print_deps_append = 0 '\000', print_include_names = 0 '\000', pedantic_errors = 0 '\000',
inhibit_warnings = 0 '\000', inhibit_errors = 0 '\000', warn_comments = 0 '\000', warn_trigraphs = 0 '\000', warn_import = 1 '\001', warn_traditional = 0 '\000',
warn_paste = 1 '\001', warnings_are_errors = 0 '\000', no_output = 0 '\000', remap = 0 '\000', no_line_commands = 0 '\000', ignore_srcdir = 0 '\000',
dollars_in_ident = 1 '\001', traditional = 0 '\000', warn_undef = 0 '\000', c89 = 0 '\000', c99 = 1 '\001', pedantic = 0 '\000', preprocessed = 0 '\000',
no_standard_includes = 0 '\000', no_standard_cplusplus_includes = 0 '\000', dump_macros = 0 '\000', debug_output = 0 '\000', dump_includes = 0 '\000',
show_column = 1 '\001'}, input_stack_listing_current = 0 '\000', no_macro_expand = 0 '\000', import_warning = 0 '\000', done_initializing = 0 '\000', skipping = 0 '\000',
save_parameter_spellings = 0 '\000', in_lex_line = 0 '\000', need_newline = 0 '\000'}
(gdb) p len
$6 = 8
(gdb) up
#2 0x4154b8 in do_assert (pfile=0x10032a40) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1364
1364 node = _cpp_parse_assertion (pfile, &new_answer);
(gdb) p new_answer
$7 = (struct answer *) 0x10038260
(gdb) p *new_answer
$8 = {next = 0x2abba95c, list = {tokens = 0x10038298, tokens_used = 1, tokens_cap = 1, namebuf = 0x10035568 "mipsd©»*\020", name_used = 4, name_cap = 4, directive = 0x0,
file = 0x0, line = 0, params_len = 0, paramc = 0, flags = 0}}
(gdb) up
#3 0x41121c in _cpp_run_directive (pfile=0x10032a40, dir=0x10032580, buf=0x8 <Address 0x8 out of bounds>, count=3) at /home/sites/home/users/aj/cvs/gcc/gcc/cpplex.c:3352
3352 (void) (*dir->handler) (pfile);
(gdb) up
#4 0x4159f4 in cpp_assert (pfile=0x10032a40, str=0x7ffffe0b "machine(mips)") at /home/sites/home/users/aj/cvs/gcc/gcc/cpplib.c:1487
1487 _cpp_run_directive (pfile, &dtable[T_ASSERT], str, strlen (str));
(gdb) p str
$9 = 0x7ffffe0b "machine(mips)"
Further reducing the command line to (just with -Amachine(mips):
Starting program: /home/sites/home/users/aj/builds/gcc/gcc/./cpp -lang-c -v -iprefix ./../lib/gcc-lib/mipsel-unknown-linux-gnu/2.96/ -isystem ./include -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/bin/include -Amachine\(mips\) -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -isystem /opt/gcc-2.96/mipsel-unknown-linux-gnu/include tmp-dum.c /tmp/ccdgD2mr.i
gives the same segmentation fault.
Is the output helpful for you? Do you need any further information?
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de