https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61914

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x32-*-*                     |
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-07-28
     Ever confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
It is a bug in gengtype.c where strtok(arg, ",>") is called
recursively on

generic_wide_int<fixed_wide_int_storage<int_traits<T1>::precision>>

defined in wide-int.h:

(gdb) bt
#0  strtok () at ../sysdeps/x86_64/strtok.S:198
#1  0x004027ec in create_user_defined_type (
    type_name=0x6402e0 "fixed_wide_int_storage<int_traits<T1", 
    pos=0x637a98 <lexer_line>) at /export/gnu/import/git/gcc/gcc/gengtype.c:593
#2  0x00402967 in resolve_typedef (
    s=0x6402e0 "fixed_wide_int_storage<int_traits<T1", 
    pos=0x637a98 <lexer_line>) at /export/gnu/import/git/gcc/gcc/gengtype.c:664
#3  0x004027b0 in create_user_defined_type (
    type_name=0x6401d0
"generic_wide_int<fixed_wide_int_storage<int_traits<T1>::precision>>",
pos=0x637a98 <lexer_line>)
    at /export/gnu/import/git/gcc/gcc/gengtype.c:591
#4  0x00402967 in resolve_typedef (
    s=0x6401d0
"generic_wide_int<fixed_wide_int_storage<int_traits<T1>::precision>>",
pos=0x637a98 <lexer_line>)
    at /export/gnu/import/git/gcc/gcc/gengtype.c:664
#5  0x00413e81 in type (optsp=0xffffd10c, nested=false)
    at /export/gnu/import/git/gcc/gcc/gengtype-parse.c:854
#6  0x00414239 in typedef_decl ()
    at /export/gnu/import/git/gcc/gcc/gengtype-parse.c:1013
#7  0x0041446d in parse_file (
    fname=0x6394b9 "/export/gnu/import/git/gcc/gcc/wide-int.h")
    at /export/gnu/import/git/gcc/gcc/gengtype-parse.c:1104
#8  0x0040f953 in main (argc=7, argv=0xffffd264)
---Type <return> to continue, or q <return> to quit---
    at /export/gnu/import/git/gcc/gcc/gengtype.c:5486
(gdb) 

create_user_defined_type calls

1. strtok (arg, ",>").
2. resolve_typedef (field_name, pos), which calls create_user_defined_type,
which calls strtok (arg, ",>") again.
3. strtok (0, ",>"), which uses the wrong saved pointer.


It is a pure luck that it fails only for x32.

Reply via email to