public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
@ 2012-05-08  9:00 jgpallero at gmail dot com
  2012-05-08 16:06 ` [Bug c/53277] " pinskia at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-08  9:00 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53277
           Summary: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and
                    4.7 but not in previous releases
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jgpallero@gmail.com


Hello:

In this example:

#include<stdlib.h>
#include<string.h>
int main() {
    strspn("hello","h");
    return 0;
}

I obtain the warning:

test.c:4:5: warning: conversion to ‘size_t’ from ‘int’ may change the sign of
the result [-Wsign-conversion]

using the order:

gcc -Wall -Wextra -Wconversion -O test.c -o test

The warning appears with -O, -O1, -O2 and -O3, but not with -O0. The
warning appears in gcc 4.5, 4.6 and 4.7 but not in previous releases.

This behavior appears too if I do some assign:

#include <string.h>
#include <stdio.h>
#include <stdlib.h>


int main() {
  size_t x;
  x = strspn("hello","h");
  printf("%zd\n", x);
  return 0;
}

I think this is a bug

Cheers


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
@ 2012-05-08 16:06 ` pinskia at gcc dot gnu.org
  2012-05-09 10:51 ` jgpallero at gmail dot com
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-08 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-05-08
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-08 16:02:36 UTC ---
Can you attach the preprocessed source?  I think the headers have a macro
function for strspn .


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
  2012-05-08 16:06 ` [Bug c/53277] " pinskia at gcc dot gnu.org
@ 2012-05-09 10:51 ` jgpallero at gmail dot com
  2012-05-09 10:52 ` jgpallero at gmail dot com
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:50:35 UTC ---
Created attachment 27354
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27354
Original C code


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
  2012-05-08 16:06 ` [Bug c/53277] " pinskia at gcc dot gnu.org
  2012-05-09 10:51 ` jgpallero at gmail dot com
@ 2012-05-09 10:52 ` jgpallero at gmail dot com
  2012-05-09 10:52 ` jgpallero at gmail dot com
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:51:52 UTC ---
Created attachment 27356
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27356
Preprocessed with -O1 optimization flag


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (2 preceding siblings ...)
  2012-05-09 10:52 ` jgpallero at gmail dot com
@ 2012-05-09 10:52 ` jgpallero at gmail dot com
  2012-05-09 10:53 ` jgpallero at gmail dot com
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:51:15 UTC ---
Created attachment 27355
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27355
Preprocessed with -O0 optimization flag


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (3 preceding siblings ...)
  2012-05-09 10:52 ` jgpallero at gmail dot com
@ 2012-05-09 10:53 ` jgpallero at gmail dot com
  2012-05-09 10:54 ` jgpallero at gmail dot com
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:52:50 UTC ---
Created attachment 27357
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27357
Preprocessed with -O2 optimization flag


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (4 preceding siblings ...)
  2012-05-09 10:53 ` jgpallero at gmail dot com
@ 2012-05-09 10:54 ` jgpallero at gmail dot com
  2012-05-09 10:56 ` jgpallero at gmail dot com
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:53:19 UTC ---
Created attachment 27358
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27358
Preprocessed with -O3 optimization flag


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (5 preceding siblings ...)
  2012-05-09 10:54 ` jgpallero at gmail dot com
@ 2012-05-09 10:56 ` jgpallero at gmail dot com
  2012-05-09 11:06 ` jgpallero at gmail dot com
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:54:33 UTC ---
Hello:

I attach the preprocessed files with optimization flags -O0, -O1, -O2 and -O3

Thanks


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (6 preceding siblings ...)
  2012-05-09 10:56 ` jgpallero at gmail dot com
@ 2012-05-09 11:06 ` jgpallero at gmail dot com
  2012-05-09 12:07 ` glisse at gcc dot gnu.org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 10:56:34 UTC ---
I have used gcc 4.7.0


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (7 preceding siblings ...)
  2012-05-09 11:06 ` jgpallero at gmail dot com
@ 2012-05-09 12:07 ` glisse at gcc dot gnu.org
  2012-05-09 12:54 ` manu at gcc dot gnu.org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-05-09 12:07 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

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

--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> 2012-05-09 11:50:09 UTC ---
glibc still has:

#   define strspn(s, accept) \
  __extension__                                                               \
  ({ char __a0, __a1, __a2;                                                   \
     (__builtin_constant_p (accept) && __string2_1bptr_p (accept)             \
      ? ((__builtin_constant_p (s) && __string2_1bptr_p (s))                  \
         ? __builtin_strspn (s, accept)                                       \
         : ((__a0 = ((const char *) (accept))[0], __a0 == '\0')               \
            ? ((void) (s), 0)                                                 \
            : ((__a1 = ((const char *) (accept))[1], __a1 == '\0')            \
               ? __strspn_c1 (s, __a0)                                        \
               : ((__a2 = ((const char *) (accept))[2], __a2 == '\0')         \
                  ? __strspn_c2 (s, __a0, __a1)                               \
                  : (((const char *) (accept))[3] == '\0'                     \
                     ? __strspn_c3 (s, __a0, __a1, __a2)                      \
                     : __builtin_strspn (s, accept))))))                      \
      : __builtin_strspn (s, accept)); })

The lone 0 in the middle should be explicitly cast to size_t, like it is for
fread_unlocked. Could you report it to glibc please?

gcc could avoid this warning when converting a constant, I am pretty sure the
same issue (possibly with another macro) already led to such a conversation...


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (8 preceding siblings ...)
  2012-05-09 12:07 ` glisse at gcc dot gnu.org
@ 2012-05-09 12:54 ` manu at gcc dot gnu.org
  2012-05-09 13:11 ` jgpallero at gmail dot com
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-09 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-09 12:45:54 UTC ---
(In reply to comment #9)
> gcc could avoid this warning when converting a constant, I am pretty sure the
> same issue (possibly with another macro) already led to such a conversation...

This is not a constant. It is a conditional expression of type int. This is
PR51294.

And there is PR52617. Plenty of bugs to fix...


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (9 preceding siblings ...)
  2012-05-09 12:54 ` manu at gcc dot gnu.org
@ 2012-05-09 13:11 ` jgpallero at gmail dot com
  2012-05-09 13:12 ` glisse at gcc dot gnu.org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 13:06:56 UTC ---
Report to glibc sent


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (10 preceding siblings ...)
  2012-05-09 13:11 ` jgpallero at gmail dot com
@ 2012-05-09 13:12 ` glisse at gcc dot gnu.org
  2012-05-09 13:46 ` manu at gcc dot gnu.org
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-05-09 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Marc Glisse <glisse at gcc dot gnu.org> 2012-05-09 13:11:01 UTC ---
(In reply to comment #10)
> This is PR51294.

Looks different. Here the compiler complains about casting 0 to size_t.

> And there is PR52617.

That one is not a bug, unless you want to do the opposite of what the OP asked
and use constant propagation to remove the current warning as well.


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (11 preceding siblings ...)
  2012-05-09 13:12 ` glisse at gcc dot gnu.org
@ 2012-05-09 13:46 ` manu at gcc dot gnu.org
  2012-05-09 15:17 ` jgpallero at gmail dot com
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-09 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-09 13:34:15 UTC ---
(In reply to comment #12)
> (In reply to comment #10)
> > This is PR51294.
> 
> Looks different. Here the compiler complains about casting 0 to size_t.

No, it is not. GCC gives a very different message for implicit constant
conversions. 

Looking in more detail, I think the problem may be ((void)s, 0), which is not
recognized as a constant by Wconversion.

> > And there is PR52617.
> 
> That one is not a bug, unless you want to do the opposite of what the OP asked
> and use constant propagation to remove the current warning as well.

You are right. Closed.


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

* [Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (12 preceding siblings ...)
  2012-05-09 13:46 ` manu at gcc dot gnu.org
@ 2012-05-09 15:17 ` jgpallero at gmail dot com
  2012-05-09 15:56 ` [Bug c/53277] -Wconversion cannot handle compound expresions manu at gcc dot gnu.org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jgpallero at gmail dot com @ 2012-05-09 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from José Luis García Pallero <jgpallero at gmail dot com> 2012-05-09 15:01:30 UTC ---
Fixed in glibc:

http://sourceware.org/bugzilla/show_bug.cgi?id=14083
http://sourceware.org/git/?p=glibc.git;a=commit;h=1a4b75a190006bb013a61f2031a4de86e93a629f


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

* [Bug c/53277] -Wconversion cannot handle compound expresions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (13 preceding siblings ...)
  2012-05-09 15:17 ` jgpallero at gmail dot com
@ 2012-05-09 15:56 ` manu at gcc dot gnu.org
  2021-07-20 17:16 ` [Bug c/53277] -Wconversion cannot handle compound expressions me at xenu dot pl
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-09 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-09 15:52:48 UTC ---
A simpler testcase:

int main() {
  char i = 1;
  char x = ((void) i, 0);
  x = i ? x : ((void) i, 0);
  return 0;
}


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

* [Bug c/53277] -Wconversion cannot handle compound expressions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (14 preceding siblings ...)
  2012-05-09 15:56 ` [Bug c/53277] -Wconversion cannot handle compound expresions manu at gcc dot gnu.org
@ 2021-07-20 17:16 ` me at xenu dot pl
  2021-07-20 17:33 ` me at xenu dot pl
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: me at xenu dot pl @ 2021-07-20 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

Tomasz Konojacki <me at xenu dot pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me at xenu dot pl

--- Comment #17 from Tomasz Konojacki <me at xenu dot pl> ---
Manuel's simplified testcase was fixed in gcc 10. I believe this ticket can be
closed.

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

* [Bug c/53277] -Wconversion cannot handle compound expressions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (15 preceding siblings ...)
  2021-07-20 17:16 ` [Bug c/53277] -Wconversion cannot handle compound expressions me at xenu dot pl
@ 2021-07-20 17:33 ` me at xenu dot pl
  2021-07-20 17:41 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: me at xenu dot pl @ 2021-07-20 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Tomasz Konojacki <me at xenu dot pl> ---
Sorry, it still warns in C mode, but it doesn't in C++.

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

* [Bug c/53277] -Wconversion cannot handle compound expressions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (16 preceding siblings ...)
  2021-07-20 17:33 ` me at xenu dot pl
@ 2021-07-20 17:41 ` redi at gcc dot gnu.org
  2021-07-20 17:42 ` pinskia at gcc dot gnu.org
  2023-06-15  0:34 ` pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-20 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For C++ the comment 15 case seems to have been fixed by r10-6527:

    c++: Use constexpr to avoid wrong -Wsign-compare (PR90691).

    We would like to do constexpr evaluation to avoid false positives on
    warnings, but constexpr evaluation can involve function body copying that
    changes DECL_UID, which breaks -fcompare-debug.  So let's remember
    that we need to avoid that.

            PR c++/90691
            * expr.c (fold_for_warn): Call maybe_constant_value.
            * constexpr.c (struct constexpr_ctx): Add uid_sensitive field.
            (maybe_constant_value): Add uid_sensitive parm.
            (get_fundef_copy): Don't copy if it's true.
            (cxx_eval_call_expression): Don't instantiate if it's true.
            (cxx_eval_outermost_constant_expr): Likewise.

But it still warns when compiled as C.

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

* [Bug c/53277] -Wconversion cannot handle compound expressions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (17 preceding siblings ...)
  2021-07-20 17:41 ` redi at gcc dot gnu.org
@ 2021-07-20 17:42 ` pinskia at gcc dot gnu.org
  2023-06-15  0:34 ` pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-20 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Tomasz Konojacki from comment #18)
> Sorry, it still warns in C mode, but it doesn't in C++.

Yes it does, but only the second one of:
 char x = ((void) i, 0);
  x = i ? x : ((void) i, 0);

The first one was fixed for GCC 10.

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

* [Bug c/53277] -Wconversion cannot handle compound expressions
  2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
                   ` (18 preceding siblings ...)
  2021-07-20 17:42 ` pinskia at gcc dot gnu.org
@ 2023-06-15  0:34 ` pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-15  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roland.illig at gmx dot de

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 110259 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-06-15  0:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-08  9:00 [Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases jgpallero at gmail dot com
2012-05-08 16:06 ` [Bug c/53277] " pinskia at gcc dot gnu.org
2012-05-09 10:51 ` jgpallero at gmail dot com
2012-05-09 10:52 ` jgpallero at gmail dot com
2012-05-09 10:52 ` jgpallero at gmail dot com
2012-05-09 10:53 ` jgpallero at gmail dot com
2012-05-09 10:54 ` jgpallero at gmail dot com
2012-05-09 10:56 ` jgpallero at gmail dot com
2012-05-09 11:06 ` jgpallero at gmail dot com
2012-05-09 12:07 ` glisse at gcc dot gnu.org
2012-05-09 12:54 ` manu at gcc dot gnu.org
2012-05-09 13:11 ` jgpallero at gmail dot com
2012-05-09 13:12 ` glisse at gcc dot gnu.org
2012-05-09 13:46 ` manu at gcc dot gnu.org
2012-05-09 15:17 ` jgpallero at gmail dot com
2012-05-09 15:56 ` [Bug c/53277] -Wconversion cannot handle compound expresions manu at gcc dot gnu.org
2021-07-20 17:16 ` [Bug c/53277] -Wconversion cannot handle compound expressions me at xenu dot pl
2021-07-20 17:33 ` me at xenu dot pl
2021-07-20 17:41 ` redi at gcc dot gnu.org
2021-07-20 17:42 ` pinskia at gcc dot gnu.org
2023-06-15  0:34 ` pinskia 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).