public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64639] New: false negative of -Wunused-value
@ 2015-01-17  7:48 chengniansun at gmail dot com
  2015-01-17  8:15 ` [Bug c/64639] " chengniansun at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: chengniansun at gmail dot com @ 2015-01-17  7:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

            Bug ID: 64639
           Summary: false negative of -Wunused-value
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

I think GCC should also warn that the value of the expression "(a = 0) != 0" is
not used. 

$: cat s.c
int *a;
int b;
void f() { 
  b = (0, (a = 0) != 0, 0);
}
$: 
$: gcc-trunk -c -Wunused-value s.c
s.c: In function ‘f’:
s.c:4:9: warning: left-hand operand of comma expression has no effect
[-Wunused-value]
   b = (0, (a = 0) != 0, 0);
         ^
$: 
$: clang-trunk -c -Wunused-value s.c
s.c:4:8: warning: expression result unused [-Wunused-value]
  b = (0, (a = 0) != 0, 0);
       ^
s.c:4:19: warning: expression result unused [-Wunused-value]
  b = (0, (a = 0) != 0, 0);
          ~~~~~~~ ^  ~
2 warnings generated.
$: 
$:
>From gcc-bugs-return-473635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 17 07:51:49 2015
Return-Path: <gcc-bugs-return-473635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27721 invoked by alias); 17 Jan 2015 07:51:49 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27697 invoked by uid 48); 17 Jan 2015 07:51:45 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64639] false negative of -Wunused-value
Date: Sat, 17 Jan 2015 07:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64639-4-EKuUD77Cfm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64639-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64639-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01629.txt.bz2
Content-length: 234

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd639

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
"(a = 0) != 0" has a side effect of setting a to 0.

I think in this case, clang is incorrectly warning about it.


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

* [Bug c/64639] false negative of -Wunused-value
  2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
@ 2015-01-17  8:15 ` chengniansun at gmail dot com
  2015-01-17 18:53 ` chengniansun at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: chengniansun at gmail dot com @ 2015-01-17  8:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

Chengnian Sun <chengniansun at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chengniansun at gmail dot com

--- Comment #2 from Chengnian Sun <chengniansun at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> "(a = 0) != 0" has a side effect of setting a to 0.
> 
> I think in this case, clang is incorrectly warning about it.

I agree that (a = 0) has a side effect, but the comparison "!=" is not used.


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

* [Bug c/64639] false negative of -Wunused-value
  2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
  2015-01-17  8:15 ` [Bug c/64639] " chengniansun at gmail dot com
@ 2015-01-17 18:53 ` chengniansun at gmail dot com
  2015-01-18 13:29 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: chengniansun at gmail dot com @ 2015-01-17 18:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

--- Comment #3 from Chengnian Sun <chengniansun at gmail dot com> ---
(In reply to Chengnian Sun from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > "(a = 0) != 0" has a side effect of setting a to 0.
> > 
> > I think in this case, clang is incorrectly warning about it.
> 
> I agree that (a = 0) has a side effect, but the comparison "!=" is not used.

Please refer to the following test program. GCC emits a warning for the
expression "(a = 0) != 0".


$: cat t.c
int a;
void f() {
  (a = 0) != 0;
}
$: gcc-trunk -c -Wunused-value t.c
t.c: In function ¡®f¡¯:
t.c:3:11: warning: value computed is not used [-Wunused-value]
   (a = 0) != 0;
           ^
>From gcc-bugs-return-473670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 17 18:59:14 2015
Return-Path: <gcc-bugs-return-473670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10461 invoked by alias); 17 Jan 2015 18:59:13 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10437 invoked by uid 48); 17 Jan 2015 18:59:08 -0000
From: "chengniansun at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64648] New: Incorrect message description of -Wunused-value
Date: Sat, 17 Jan 2015 18:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: chengniansun at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-64648-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01664.txt.bz2
Content-length: 1365

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64648

            Bug ID: 64648
           Summary: Incorrect message description of -Wunused-value
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

GCC emits a -Wunused-value warning with a wrong description for the expression
"(a = 0) >= 0". There is no comma expression, but the message is 

        right-hand operand of comma expression has no effect

If I change the operator from ">=" to "!=", then the message is correct. 




$: cat t.c
int a;
void f() {
  (a = 0) != 0;
  (a = 0) >= 0;
}
$: 
$: gcc-trunk -c -Wunused-value t.c
t.c: In function ‘f’:
t.c:3:11: warning: value computed is not used [-Wunused-value]
   (a = 0) != 0;
           ^
t.c:4:11: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
   (a = 0) >= 0;
           ^
$: 
$: clang-trunk -c -Wunused-value t.c
t.c:3:11: warning: inequality comparison result unused [-Wunused-comparison]
  (a = 0) != 0;
  ~~~~~~~~^~~~
t.c:4:11: warning: relational comparison result unused [-Wunused-comparison]
  (a = 0) >= 0;
  ~~~~~~~~^~~~
2 warnings generated.
$:
>From gcc-bugs-return-473671-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 17 19:09:21 2015
Return-Path: <gcc-bugs-return-473671-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17266 invoked by alias); 17 Jan 2015 19:09:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17216 invoked by uid 48); 17 Jan 2015 19:09:14 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60922] [4.9/5 regression] Memory leak with allocatable CLASS components
Date: Sat, 17 Jan 2015 19:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: janus at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to
Message-ID: <bug-60922-4-3jzARbFrL3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60922-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60922-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01665.txt.bz2
Content-length: 1038

https://gcc.gnu.org/bugzilla/show_bug.cgi?id`922

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org

--- Comment #10 from janus at gcc dot gnu.org ---
The following patchlet seems to fix it. Might just be a copy'n'paste error?


Index: gcc/fortran/class.c
==================================================================--- gcc/fortran/class.c    (Revision 219801)
+++ gcc/fortran/class.c    (Arbeitskopie)
@@ -875,7 +875,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *de
       /* Add IF (fini_coarray).  */
       if (comp->attr.codimension
       || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)
-          && CLASS_DATA (comp)->attr.allocatable))
+          && CLASS_DATA (comp)->attr.codimension))
     {
       block = gfc_get_code (EXEC_IF);
       if (*code)


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

* [Bug c/64639] false negative of -Wunused-value
  2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
  2015-01-17  8:15 ` [Bug c/64639] " chengniansun at gmail dot com
  2015-01-17 18:53 ` chengniansun at gmail dot com
@ 2015-01-18 13:29 ` manu at gcc dot gnu.org
  2015-01-20  9:32 ` maltsevm at gmail dot com
  2020-05-19 17:19 ` [Bug c/64639] missing warning by -Wunused-value in compound expressions msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2015-01-18 13:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-18
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
b = (0, (a = 0) != 0, 0);

gets somehow transformed into

b = (a = 0B) != 0B;, 0;

(or the pretty-printer in tree-original cannot actually represent the internal
AST).

The warning is bizarre anyway.
>From gcc-bugs-return-473706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 18 13:36:10 2015
Return-Path: <gcc-bugs-return-473706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10449 invoked by alias); 18 Jan 2015 13:36:09 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10427 invoked by uid 48); 18 Jan 2015 13:36:05 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64644] "warning: anonymous union with no members" should be an error with -pedantic-errors
Date: Sun, 18 Jan 2015 13:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-64644-4-SulgxJJVgC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64644-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64644-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01700.txt.bz2
Content-length: 1174

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64644

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
A untested patch, feel free to test it and submit it.

Index: decl2.c
===================================================================
--- decl2.c     (revision 218749)
+++ decl2.c     (working copy)
@@ -1604,11 +1604,11 @@ finish_anon_union (tree anon_union_decl)
   main_decl = build_anon_union_vars (type, anon_union_decl);
   if (main_decl == error_mark_node)
     return;
   if (main_decl == NULL_TREE)
     {
-      warning (0, "anonymous union with no members");
+      pedwarn (input_location, 0, "anonymous union with no members");
       return;
     }

   if (!processing_template_decl)
     {
>From gcc-bugs-return-473707-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 18 13:47:05 2015
Return-Path: <gcc-bugs-return-473707-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12990 invoked by alias); 18 Jan 2015 13:47:04 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12963 invoked by uid 48); 18 Jan 2015 13:47:00 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64643] bad location for multiple fields in union initialized
Date: Sun, 18 Jan 2015 13:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-64643-4-uvsEBjpbRP@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64643-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64643-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01701.txt.bz2
Content-length: 906

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64643

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-18
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
You can find the code in gcc/cp/class.c. You'll need to replace:

error ("multiple fields in union %qT initialized", t);

with something like:

error_at (loc2, "multiple fields in union %qT initialized", t);
inform (loc1, "a field is already initialized here");

where the tricky part is to set loc1 and loc2 appropriately.
>From gcc-bugs-return-473708-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 18 13:48:04 2015
Return-Path: <gcc-bugs-return-473708-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13840 invoked by alias); 18 Jan 2015 13:48:03 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13738 invoked by uid 48); 18 Jan 2015 13:47:58 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64637] Incorrect location for -Wunused-value warnings in for-loop
Date: Sun, 18 Jan 2015 13:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-64637-4-drDRRmaRRt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64637-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64637-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01702.txt.bz2
Content-length: 657

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64637

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-18
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Confirmed, but I think we already have a duplicated PR for this somewhere.
>From gcc-bugs-return-473709-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 18 13:50:58 2015
Return-Path: <gcc-bugs-return-473709-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15018 invoked by alias); 18 Jan 2015 13:50:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 14959 invoked by uid 48); 18 Jan 2015 13:50:53 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/64435] [5 Regression] Bootstrap failure in libsanitizer on AArch64 with Linux kernel <= 3.15
Date: Sun, 18 Jan 2015 13:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: major
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64435-4-IHn8eJLirf@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64435-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64435-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg01703.txt.bz2
Content-length: 293

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd435

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And the reason for that is that aarch64 again changed ABI, what a stable port
:(.

https://sourceware.org/git/?p=glibc.git;a=commit;h\40c3bab2fddaca8cfe12d75944d1fef8adf1a4


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

* [Bug c/64639] false negative of -Wunused-value
  2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
                   ` (2 preceding siblings ...)
  2015-01-18 13:29 ` manu at gcc dot gnu.org
@ 2015-01-20  9:32 ` maltsevm at gmail dot com
  2020-05-19 17:19 ` [Bug c/64639] missing warning by -Wunused-value in compound expressions msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: maltsevm at gmail dot com @ 2015-01-20  9:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

Mikhail Maltsev <maltsevm at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maltsevm at gmail dot com

--- Comment #5 from Mikhail Maltsev <maltsevm at gmail dot com> ---
> gets somehow transformed into
> b = (a = 0B) != 0B;, 0;

Probably folding works this way. Anyway, I think, I can explain how the warning
is [not] generated (I stepped through the code using GDB). So:
We start parsing RHS of assignment expression (the outermost one). After
parsing two operands of comma, we get into build_compound_expr function (in
c-typeck.c) and this function generates a warning because "left-hand operand of
comma expression" (i.e. 0) "has no effect" (that's true, but the wording is a
bit strange). Then we parse the next comma expression and get into the same
function. The code of build_compound_expr looks like this:

    ...
  if (!TREE_SIDE_EFFECTS (expr1))
    ...
  else if (TREE_CODE (expr1) == COMPOUND_EXPR && warn_unused_value)
    ...

  /* With -Wunused, we should also warn if the left-hand operand does have
     side-effects, but computes a value which is not used.  For example, in
     `foo() + bar(), baz()' the result of the `+' operator is not used,
     so we should issue a warning.  */
  else if (warn_unused_value)
    warn_if_unused_value (expr1, loc);

Unfortunately, we don't get into warn_if_unused_value because the condition of
previous branch is true. That's why there is no warning about the result of
comparison.

P.S. I know, that it all might be obvious for most of you, but I'm just trying
to get acquainted with GCC sources and (hopefully) do something useful for the
project, while waiting for next stage1 (bugs being fixed during stage 4 are
obviously not for newcomers).


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

* [Bug c/64639] missing warning by -Wunused-value in compound expressions
  2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
                   ` (3 preceding siblings ...)
  2015-01-20  9:32 ` maltsevm at gmail dot com
@ 2020-05-19 17:19 ` msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-05-19 17:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
*** Bug 95217 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2020-05-19 17:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-17  7:48 [Bug c/64639] New: false negative of -Wunused-value chengniansun at gmail dot com
2015-01-17  8:15 ` [Bug c/64639] " chengniansun at gmail dot com
2015-01-17 18:53 ` chengniansun at gmail dot com
2015-01-18 13:29 ` manu at gcc dot gnu.org
2015-01-20  9:32 ` maltsevm at gmail dot com
2020-05-19 17:19 ` [Bug c/64639] missing warning by -Wunused-value in compound expressions msebor 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).