[Bug lto/42528] ICE with -flto and -fsigned-char

2009-12-31 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2009-12-31 15:08 ---
Confirmed on i?86-linux with -funsigned-char instead.

I'll have a looksee.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Keywords||ice-on-valid-code
   Last reconfirmed|-00-00 00:00:00 |2009-12-31 15:08:45
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-03 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2010-01-03 14:33 ---
This is because va_list_type_node is char * on some targets and so
pointer-to char types get globbed into it.  But va_list_type_node is
re-constructed as char * at IL read time and thus we read back
unsigned char * as signed char *.

Oops.

I guess va_list_type_node better should be _not_ dependent on
-f[un]signed-char.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-03 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2010-01-03 17:31 ---
The same problem exists for builtin functions that return or take arguments
of type char *.  They change signature according to -f[un]signed-char which
causes for example

FAIL: gcc.c-torture/execute/builtins/strcpy-chk.c compilation,  -O2 -flto 
(internal compiler error)

when running with -funsigned-char on x86:

char p[32] = "";
int main ()
{
  if (__builtin___strcpy_chk (p + 1, "vwxyz",
  __builtin_object_size (p + 1, 0)) != p + 1)
__builtin_abort ();
  return 0;
} 

$ /obj/trunk-g/gcc/xgcc -B/obj/trunk-g/gcc/ strcpy-chk.3.i -O -flto
-funsigned-char
In file included from :0:0:
strcpy-chk.3.i: In function 'main':
strcpy-chk.3.i:2:5: error: non-trivial conversion at assignment
 *
 *
D.2023_3 = D.2027_5;

strcpy-chk.3.i:2:5: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-03 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2010-01-03 18:12 ---
Which seems to be because of CCP which folds

D.2023_3 = __builtin___strcpy_chk (&p[1], &"vwxyz"[0], 31);

with unsigned LHS to

D.2023_3 = ( *) __builtin_memcpy (&p[1], &"vwxyz"[0], 6);

which requires a temporary and thus exposes the mismatched types to the
verifier (we don't verify function assignments).

Which is also because lto1 doesn't understand -f[un]signed-char and always
has flag_signed_char set to the target default because

1044  /* Share char_type_node with whatever would be the default for the
target.
1045 char_type_node will be used for internal types such as
1046 va_list_type_node but will not be present in the lto stream.  */
1047  char_type_node
1048= DEFAULT_SIGNED_CHAR ? signed_char_type_node :
unsigned_char_type_node;

the comment is true, but still units with different setting of
flag_signed_char will have different va_list_type_node and different
function signatures for builtin string functions.

Now the above together with LTO1 not recognizing -f[un]signed-char
even breaks consistent but non-standard flag_signed_char setting.
Whatever is more important ...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-03 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2010-01-03 18:21 ---
Created an attachment (id=19455)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19455&action=view)
patch

Patch I am going to test.  Further testing appreciated.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-07 Thread anton at samba dot org


--- Comment #6 from anton at samba dot org  2010-01-07 11:01 ---
Thanks Richard, it passes my tests.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-08 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2010-01-08 16:58 ---
Subject: Bug 42528

Author: rguenth
Date: Fri Jan  8 16:57:59 2010
New Revision: 155740

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155740
Log:
2010-01-08  Richard Guenther  

PR lto/42528
* c.opt (fsigned-char): Also let LTO handle this option.
(funsigned-char): Likewise.

lto/
* lto-lang.c (lto_handle_option): Handle -f[un]signed-char.
(lto_init): Do not init char_type_node in a standard way
but according to flag_signed_char.

* gcc.dg/lto/20100103-1_0.c: New testcase.
* gcc.dg/lto/20100103-2_0.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/lto/20100103-1_0.c
trunk/gcc/testsuite/gcc.dg/lto/20100103-2_0.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c.opt
trunk/gcc/lto/ChangeLog
trunk/gcc/lto/lto-lang.c
trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528



[Bug lto/42528] ICE with -flto and -fsigned-char

2010-01-08 Thread rguenth at gcc dot gnu dot org


--- Comment #8 from rguenth at gcc dot gnu dot org  2010-01-08 16:58 ---
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528