public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21159] New: "no effect" warning despite cast to void*
@ 2005-04-22 11:00 bruno at clisp dot org
2005-04-22 11:01 ` [Bug c/21159] " bruno at clisp dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: bruno at clisp dot org @ 2005-04-22 11:00 UTC (permalink / raw)
To: gcc-bugs
The gcc-4.0 manual says
* An expression-statement or the left-hand side of a comma
expression contains no side effects. To suppress the
warning, cast the unused expression to void. For example, an
expression such as `x[i,j]' will cause a warning, but
`x[(void)i,j]' will not.
This worked for earlier releases of gcc, but in gcc-4.0 the cast to void
doesn't avoid the warning.
$ gcc -v
Using built-in specs.
Target: powerpc-apple-darwin7.8.0
Configured with: /Users/bruno/data/work/gcc-4.0.0-20050410/configure
--prefix=/Volumes/UserData/experimental-macos --enable-shared
--enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: posix
gcc version 4.0.0 20050410 (prerelease)
$ gcc -W -c foo.c
foo.c: In function 'foo':
foo.c:4: warning: left-hand operand of comma expression has no effect
$ gcc -W -c bug.c
bug.c: In function 'copy_string':
bug.c:169: warning: left-hand operand of comma expression has no effect
--
Summary: "no effect" warning despite cast to void*
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bruno at clisp dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.8.0
GCC host triplet: powerpc-apple-darwin7.8.0
GCC target triplet: powerpc-apple-darwin7.8.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
@ 2005-04-22 11:01 ` bruno at clisp dot org
2005-04-22 11:02 ` bruno at clisp dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bruno at clisp dot org @ 2005-04-22 11:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bruno at clisp dot org 2005-04-22 11:01 -------
Created an attachment (id=8706)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8706&action=view)
source file foo.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
2005-04-22 11:01 ` [Bug c/21159] " bruno at clisp dot org
@ 2005-04-22 11:02 ` bruno at clisp dot org
2005-04-22 11:22 ` [Bug c/21159] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bruno at clisp dot org @ 2005-04-22 11:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bruno at clisp dot org 2005-04-22 11:01 -------
Created an attachment (id=8707)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8707&action=view)
source file bug.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
2005-04-22 11:01 ` [Bug c/21159] " bruno at clisp dot org
2005-04-22 11:02 ` bruno at clisp dot org
@ 2005-04-22 11:22 ` pinskia at gcc dot gnu dot org
2005-04-22 11:24 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-22 11:22 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Keywords| |diagnostic
Summary|"no effect" warning despite |[4.0/4.1 Regression] "no
|cast to void* |effect" warning despite cast
| |to void*
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
` (2 preceding siblings ...)
2005-04-22 11:22 ` [Bug c/21159] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-22 11:24 ` pinskia at gcc dot gnu dot org
2005-04-26 21:56 ` jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-22 11:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-22 11:23 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Known to fail| |4.0.0 4.1.0
Known to work| |3.4.0
Last reconfirmed|0000-00-00 00:00:00 |2005-04-22 11:23:13
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
` (3 preceding siblings ...)
2005-04-22 11:24 ` pinskia at gcc dot gnu dot org
@ 2005-04-26 21:56 ` jsm28 at gcc dot gnu dot org
2005-04-27 21:41 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-04-26 21:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-04-26 21:55 -------
What's actually happening is that GCC 4 is building trees for comma expressions
in accordance with how the C standard says they are parsed, where previous
versions were not.
(void)a, (void)b, c
is parsed as ((void)a, (void)b), c rather than as (void)a, ((void)b, c). The
choice of internal representation should make no difference to the code
generated but as here it can affect diagnostics. The diagnostic does seem
useless here where the left-hand side of the expression is a comma expression
with the right-hand side cast to void, so I'll add that as a case for which the
diagnostic is disabled.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jsm28 at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2005-04-22 11:23:13 |2005-04-26 21:55:59
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
` (4 preceding siblings ...)
2005-04-26 21:56 ` jsm28 at gcc dot gnu dot org
@ 2005-04-27 21:41 ` cvs-commit at gcc dot gnu dot org
2005-04-27 21:48 ` cvs-commit at gcc dot gnu dot org
2005-04-27 21:49 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-27 21:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-27 21:41 -------
Subject: Bug 21159
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jsm28@gcc.gnu.org 2005-04-27 21:41:15
Modified files:
gcc : ChangeLog c-typeck.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: void-cast-1.c
Log message:
PR c/21159
* c-typeck.c (build_compound_expr): Don't warn for left-hand side
being a compound expression whose right-hand side is cast to void.
testsuite:
* gcc.dg/void-cast-1.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8501&r2=2.8502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.436&r2=1.437
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5407&r2=1.5408
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/void-cast-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
` (5 preceding siblings ...)
2005-04-27 21:41 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-27 21:48 ` cvs-commit at gcc dot gnu dot org
2005-04-27 21:49 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-27 21:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-27 21:47 -------
Subject: Bug 21159
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: jsm28@gcc.gnu.org 2005-04-27 21:47:31
Modified files:
gcc : ChangeLog c-typeck.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: void-cast-1.c
Log message:
PR c/21159
* c-typeck.c (build_compound_expr): Don't warn for left-hand side
being a compound expression whose right-hand side is cast to void.
testsuite:
* gcc.dg/void-cast-1.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.198&r2=2.7592.2.199
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.419.2.2&r2=1.419.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.143&r2=1.5084.2.144
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/void-cast-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/21159] [4.0/4.1 Regression] "no effect" warning despite cast to void*
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
` (6 preceding siblings ...)
2005-04-27 21:48 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-27 21:49 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-27 21:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-27 21:49 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21159
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-04-27 21:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-22 11:00 [Bug c/21159] New: "no effect" warning despite cast to void* bruno at clisp dot org
2005-04-22 11:01 ` [Bug c/21159] " bruno at clisp dot org
2005-04-22 11:02 ` bruno at clisp dot org
2005-04-22 11:22 ` [Bug c/21159] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-04-22 11:24 ` pinskia at gcc dot gnu dot org
2005-04-26 21:56 ` jsm28 at gcc dot gnu dot org
2005-04-27 21:41 ` cvs-commit at gcc dot gnu dot org
2005-04-27 21:48 ` cvs-commit at gcc dot gnu dot org
2005-04-27 21:49 ` pinskia 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).