public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49068] New: Failure to auto-cast in expression, results in broken code
@ 2011-05-19 18:34 thomas.evans at nrl dot navy.mil
2011-05-19 18:44 ` [Bug c/49068] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: thomas.evans at nrl dot navy.mil @ 2011-05-19 18:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49068
Summary: Failure to auto-cast in expression, results in broken
code
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: thomas.evans@nrl.navy.mil
Subject:
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
=========================================================
Predicate:
the code:
int gnome, jape[20];
char buff[888];
gnome = sscanf(buff," %d %d %d %d %d %d %d %d %d",jape+0, jape+1, jape+2, &
jape+3, jape+4, jape+5, jape+6, jape+7, jape+8);
generates the following warning:
warning: format '%d' expects type 'int *', but argument 6 has type 'int
(*)[20]'
also, the code does not work properly -- the values in jape[] are not the same
as those in the buff[] array.
The cause apears to be the expression jape+0 (or maybeso jape+5, but that makes
much less sense from my naive perspective) being prematurely optimized by
removal of the +0, which would otherwise force a quiet cast of jape from
'int (*)[20]' to 'int *'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/49068] Failure to auto-cast in expression, results in broken code
2011-05-19 18:34 [Bug c/49068] New: Failure to auto-cast in expression, results in broken code thomas.evans at nrl dot navy.mil
@ 2011-05-19 18:44 ` pinskia at gcc dot gnu.org
2011-05-19 18:54 ` pinskia at gcc dot gnu.org
2011-05-20 9:56 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-05-19 18:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49068
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-05-19 18:17:17 UTC ---
It does say which argument too: "argument 6".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/49068] Failure to auto-cast in expression, results in broken code
2011-05-19 18:34 [Bug c/49068] New: Failure to auto-cast in expression, results in broken code thomas.evans at nrl dot navy.mil
2011-05-19 18:44 ` [Bug c/49068] " pinskia at gcc dot gnu.org
@ 2011-05-19 18:54 ` pinskia at gcc dot gnu.org
2011-05-20 9:56 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-05-19 18:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49068
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-05-19 18:16:53 UTC ---
&jape+3 is the issue.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/49068] Failure to auto-cast in expression, results in broken code
2011-05-19 18:34 [Bug c/49068] New: Failure to auto-cast in expression, results in broken code thomas.evans at nrl dot navy.mil
2011-05-19 18:44 ` [Bug c/49068] " pinskia at gcc dot gnu.org
2011-05-19 18:54 ` pinskia at gcc dot gnu.org
@ 2011-05-20 9:56 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-20 9:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49068
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-20 09:40:25 UTC ---
&jape + 3 doesn't do what you think.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-20 9:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 18:34 [Bug c/49068] New: Failure to auto-cast in expression, results in broken code thomas.evans at nrl dot navy.mil
2011-05-19 18:44 ` [Bug c/49068] " pinskia at gcc dot gnu.org
2011-05-19 18:54 ` pinskia at gcc dot gnu.org
2011-05-20 9:56 ` rguenth at gcc dot gnu.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).