public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37985] [4.3/4.4/4.5/4.6/4.7 Regression] unsigned char shift lacks "statement with no effect" warning
       [not found] <bug-37985-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-27 13:52 ` rguenth at gcc dot gnu.org
  2012-01-16  9:30 ` [Bug c/37985] [4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.6                       |4.4.7

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 12:13:32 UTC ---
4.3 branch is being closed, moving to 4.4.7 target.


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

* [Bug c/37985] [4.4/4.5/4.6/4.7 Regression] unsigned char shift lacks "statement with no effect" warning
       [not found] <bug-37985-4@http.gcc.gnu.org/bugzilla/>
  2011-06-27 13:52 ` [Bug c/37985] [4.3/4.4/4.5/4.6/4.7 Regression] unsigned char shift lacks "statement with no effect" warning rguenth at gcc dot gnu.org
@ 2012-01-16  9:30 ` rguenth at gcc dot gnu.org
  2012-03-13 13:57 ` [Bug c/37985] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
  2012-04-19 10:30 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-16  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-16 09:00:15 UTC ---
The patch at http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00669.html does
not work as we then warn for gcc.dg/20040202-1.c

gcc.dg/20040202-1.c:7:5: warning: statement with no effect [-Wunused-value]

which we do because we fold the memcpy (dest, src, 0); to
(dest = src, (void *)dest) with a TREE_NO_WARNING flag on the cast.

So we run afoul of having only one TREE_NO_WARNING flag, thus trying to
disable a specific warning using a cast will also disable other useful
ones.

The patch that caused this regression
(http://gcc.gnu.org/ml/gcc-patches/2006-08/msg01041.html) is patching a too
generic place to handle the situation.

That issue is probably similar to the fallout of the above patch - we fold
too much and too early for these kind of warnings (thus the C AST deviates
too much from the source input).

For the statement with no effect warning we emit that from c_process_expr_stmt
()
which calls c_fully_fold _before_ emitting those warnings (for whatever
historical reasons...).  Doing

Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c      (revision 183205)
+++ gcc/c-typeck.c      (working copy)
@@ -9186,8 +9190,6 @@ c_process_expr_stmt (location_t loc, tre
   if (!expr)
     return NULL_TREE;

-  expr = c_fully_fold (expr, false, NULL);
-
   if (warn_sequence_point)
     verify_sequence_points (expr);

@@ -9213,6 +9215,8 @@ c_process_expr_stmt (location_t loc, tre
       || TREE_CODE (exprv) == ADDR_EXPR)
     mark_exp_read (exprv);

+  expr = c_fully_fold (expr, false, NULL);
+
   /* If the expression is not of a type to which we cannot assign a line
      number, wrap the thing in a no-op NOP_EXPR.  */
   if (DECL_P (expr) || CONSTANT_CLASS_P (expr))

ontop of the patch "fixes" this issue.


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

* [Bug c/37985] [4.5/4.6/4.7/4.8 Regression] unsigned char shift lacks "statement with no effect" warning
       [not found] <bug-37985-4@http.gcc.gnu.org/bugzilla/>
  2011-06-27 13:52 ` [Bug c/37985] [4.3/4.4/4.5/4.6/4.7 Regression] unsigned char shift lacks "statement with no effect" warning rguenth at gcc dot gnu.org
  2012-01-16  9:30 ` [Bug c/37985] [4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
@ 2012-03-13 13:57 ` jakub at gcc dot gnu.org
  2012-04-19 10:30 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.7                       |4.5.4

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 12:46:29 UTC ---
4.4 branch is being closed, moving to 4.5.4 target.


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

* [Bug c/37985] [4.5/4.6/4.7/4.8 Regression] unsigned char shift lacks "statement with no effect" warning
       [not found] <bug-37985-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-03-13 13:57 ` [Bug c/37985] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
@ 2012-04-19 10:30 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-19 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

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

--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-19 10:27:39 UTC ---
Re-fixed by 

------------------------------------------------------------------------
r186586 | chrbr | 2012-04-19 11:06:53 +0200 (Thu, 19 Apr 2012) | 1 line

Fix #52283 error: case label does not reduce to an integer constant
------------------------------------------------------------------------


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

end of thread, other threads:[~2012-04-19 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37985-4@http.gcc.gnu.org/bugzilla/>
2011-06-27 13:52 ` [Bug c/37985] [4.3/4.4/4.5/4.6/4.7 Regression] unsigned char shift lacks "statement with no effect" warning rguenth at gcc dot gnu.org
2012-01-16  9:30 ` [Bug c/37985] [4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-03-13 13:57 ` [Bug c/37985] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-04-19 10:30 ` manu 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).