public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/42528] New: ICE with -flto and -fsigned-char
@ 2009-12-28 22:58 anton at samba dot org
2009-12-31 15:09 ` [Bug lto/42528] " rguenth at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: anton at samba dot org @ 2009-12-28 22:58 UTC (permalink / raw)
To: gcc-bugs
A gcc build from svn today (20091228) gets an ICE on the following code when
using -flto and -fsigned-char:
char *foo;
int main()
{
foo = "bar";
}
# /gcc-test/bin/gcc -flto -fsigned-char foo.c
In function 'main':
lto1: error: type mismatch in address expression
<unnamed-unsigned:8> *
<unnamed-signed:8>
foo = &"bar"[0];
lto1: internal compiler error: verify_stmts failed
It passes with either option on its own.
--
Summary: ICE with -flto and -fsigned-char
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anton at samba dot org
GCC target triplet: powerpc64-linux-gnu-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
@ 2009-12-31 15:09 ` rguenth at gcc dot gnu dot org
2010-01-03 14:33 ` rguenth at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-31 15:09 UTC (permalink / raw)
To: gcc-bugs
------- 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|0000-00-00 00:00:00 |2009-12-31 15:08:45
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
2009-12-31 15:09 ` [Bug lto/42528] " rguenth at gcc dot gnu dot org
@ 2010-01-03 14:33 ` rguenth at gcc dot gnu dot org
2010-01-03 17:31 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-03 14:33 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
2009-12-31 15:09 ` [Bug lto/42528] " rguenth at gcc dot gnu dot org
2010-01-03 14:33 ` rguenth at gcc dot gnu dot org
@ 2010-01-03 17:31 ` rguenth at gcc dot gnu dot org
2010-01-03 18:12 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-03 17:31 UTC (permalink / raw)
To: gcc-bugs
------- 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
<unnamed-unsigned:8> *
<unnamed-signed:8> *
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 <http://gcc.gnu.org/bugs.html> for instructions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42528
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
` (2 preceding siblings ...)
2010-01-03 17:31 ` rguenth at gcc dot gnu dot org
@ 2010-01-03 18:12 ` rguenth at gcc dot gnu dot org
2010-01-03 18:21 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-03 18:12 UTC (permalink / raw)
To: gcc-bugs
------- 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 = (<unnamed-signed:8> *) __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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
` (3 preceding siblings ...)
2010-01-03 18:12 ` rguenth at gcc dot gnu dot org
@ 2010-01-03 18:21 ` rguenth at gcc dot gnu dot org
2010-01-07 11:01 ` anton at samba dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-03 18:21 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
` (4 preceding siblings ...)
2010-01-03 18:21 ` rguenth at gcc dot gnu dot org
@ 2010-01-07 11:01 ` anton at samba dot org
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: anton at samba dot org @ 2010-01-07 11:01 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
` (6 preceding siblings ...)
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
@ 2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-08 16:58 UTC (permalink / raw)
To: gcc-bugs
------- 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 <rguenther@suse.de>
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/42528] ICE with -flto and -fsigned-char
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
` (5 preceding siblings ...)
2010-01-07 11:01 ` anton at samba dot org
@ 2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-08 16:58 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-01-08 16:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-28 22:58 [Bug lto/42528] New: ICE with -flto and -fsigned-char anton at samba dot org
2009-12-31 15:09 ` [Bug lto/42528] " rguenth at gcc dot gnu dot org
2010-01-03 14:33 ` rguenth at gcc dot gnu dot org
2010-01-03 17:31 ` rguenth at gcc dot gnu dot org
2010-01-03 18:12 ` rguenth at gcc dot gnu dot org
2010-01-03 18:21 ` rguenth at gcc dot gnu dot org
2010-01-07 11:01 ` anton at samba dot org
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
2010-01-08 16:58 ` rguenth at gcc dot gnu dot org
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).