public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap
@ 2014-07-25 21:59 hjl.tools at gmail dot com
  2014-07-28  8:27 ` [Bug bootstrap/61914] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-07-25 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61914
           Summary: [4.10 Regression] wide-int change breaks x32 bootstrap
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com

r210113 breaks x32 bootstrap when GCC is compiled as x32 binary with

# CC="gcc -mx32" CXX="g++ -mx32" .../gcc/configure

I got

[hjl@gnu-mic-2 build-x86_64-linux]$ grep xfff gcc/gtype.state
   (!pair  "A\xfffffff1"
    (!type undefined 1484 nil  gc_unused "A\xfffffff1"
   (!pair  "A\xfffffff1"
 (!pair  "A\xfffffff1"
[hjl@gnu-mic-2 build-x86_64-linux]$


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks x32 bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
@ 2014-07-28  8:27 ` rguenth at gcc dot gnu.org
  2014-07-28 17:12 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-28  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.9.0                       |4.10.0
   Target Milestone|---                         |4.10.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks x32 bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
  2014-07-28  8:27 ` [Bug bootstrap/61914] " rguenth at gcc dot gnu.org
@ 2014-07-28 17:12 ` hjl.tools at gmail dot com
  2014-07-28 17:22 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-07-28 17:12 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks x32 bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
  2014-07-28  8:27 ` [Bug bootstrap/61914] " rguenth at gcc dot gnu.org
  2014-07-28 17:12 ` hjl.tools at gmail dot com
@ 2014-07-28 17:22 ` hjl.tools at gmail dot com
  2014-07-28 22:16 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-07-28 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
This works:

diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index ffe3f94..ce143ad 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -599,7 +599,8 @@ create_user_defined_type (const char *type_name, struct
fileloc *pos)
      comma-separated list of strings, implicitly assumed to
      be type names, potentially with "*" characters.  */
       char *arg = open_bracket + 1;
-      char *type_id = strtok (arg, ",>");
+      char *saved_pointer;
+      char *type_id = strtok_r (arg, ",>", &saved_pointer);
       pair_p fields = 0;
       while (type_id)
     {
@@ -628,7 +629,7 @@ create_user_defined_type (const char *type_name, struct
fileloc *pos)
         arg_type = resolve_typedef (field_name, pos);

       fields = create_field_at (fields, arg_type, field_name, 0, pos);
-      type_id = strtok (0, ",>");
+      type_id = strtok_r (0, ",>", &saved_pointer);
     }

       /* Associate the field list to TY.  */

But we may need a strtok_r in libiberty.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks x32 bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2014-07-28 17:22 ` hjl.tools at gmail dot com
@ 2014-07-28 22:16 ` hjl.tools at gmail dot com
  2014-07-29 16:23 ` [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks bootstrap hjl at gcc dot gnu.org
  2014-07-29 16:24 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-07-28 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 33198
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33198&action=edit
A patch


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2014-07-28 22:16 ` hjl.tools at gmail dot com
@ 2014-07-29 16:23 ` hjl at gcc dot gnu.org
  2014-07-29 16:24 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-07-29 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Tue Jul 29 15:19:22 2014
New Revision: 213213

URL: https://gcc.gnu.org/viewcvs?rev=213213&root=gcc&view=rev
Log:
Replace strtok with strtoken

    PR bootstrap/61914
    * gengtype.c (strtoken): New function.
    (create_user_defined_type): Replace strtok with strtoken.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gengtype.c


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks bootstrap
  2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2014-07-29 16:23 ` [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks bootstrap hjl at gcc dot gnu.org
@ 2014-07-29 16:24 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2014-07-29 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-29 16:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 21:59 [Bug bootstrap/61914] New: [4.10 Regression] wide-int change breaks x32 bootstrap hjl.tools at gmail dot com
2014-07-28  8:27 ` [Bug bootstrap/61914] " rguenth at gcc dot gnu.org
2014-07-28 17:12 ` hjl.tools at gmail dot com
2014-07-28 17:22 ` hjl.tools at gmail dot com
2014-07-28 22:16 ` hjl.tools at gmail dot com
2014-07-29 16:23 ` [Bug bootstrap/61914] [4.10 Regression] wide-int change breaks bootstrap hjl at gcc dot gnu.org
2014-07-29 16:24 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).