public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
@ 2015-02-12 10:10 ` rguenth at gcc dot gnu.org
  2015-02-12 10:37 ` mpolacek at gcc dot gnu.org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-12 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


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

* [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken
@ 2015-02-12 10:10 rguenth at gcc dot gnu.org
  2015-02-12 10:10 ` [Bug c/65040] " rguenth at gcc dot gnu.org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-12 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65040
           Summary: [5 Regression] gcc-5 -Wformat broken
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org

$ cat | gcc-5 -x c - -c -o /dev/null -Wformat=2
#include <stdio.h>

void x(unsigned short arg)
{
        printf("%x\n", arg);
}
^D
gives:
<stdin>: In function ‘x’:
<stdin>:5:16: warning: format ‘%x’ expects argument of type ‘unsigned int’, but
argument 2 has type ‘int’ [-Wformat=]

but we know the range of (int)arg is [0, USHORT_MAX] so the warning isn't
helpful - it is technically true but there is no reason to warn here.
>From gcc-bugs-return-476991-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 12 10:33:58 2015
Return-Path: <gcc-bugs-return-476991-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23676 invoked by alias); 12 Feb 2015 10:33: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 23621 invoked by uid 48); 12 Feb 2015 10:33:54 -0000
From: "ramana at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65031] [5 Regression] ICE (segfault) on arm-linux-gnueabihf
Date: Thu, 12 Feb 2015 10:33:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ramana 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-65031-4-jzzlDLsEBf@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65031-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65031-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-02/txt/msg01324.txt.bz2
Content-length: 184

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

--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Appears to work with r220637. Checking if dup of PR65003.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
  2015-02-12 10:10 ` [Bug c/65040] " rguenth at gcc dot gnu.org
@ 2015-02-12 10:37 ` mpolacek at gcc dot gnu.org
  2015-02-12 10:46 ` mpolacek at gcc dot gnu.org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-12 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-12
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
  2015-02-12 10:10 ` [Bug c/65040] " rguenth at gcc dot gnu.org
  2015-02-12 10:37 ` mpolacek at gcc dot gnu.org
@ 2015-02-12 10:46 ` mpolacek at gcc dot gnu.org
  2015-02-12 11:05 ` jakub at gcc dot gnu.org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-12 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Taking.  I think check_format_types needs a small tweak to look thru NOP_EXPRs.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-02-12 10:46 ` mpolacek at gcc dot gnu.org
@ 2015-02-12 11:05 ` jakub at gcc dot gnu.org
  2015-02-12 11:07 ` jakub at gcc dot gnu.org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-12 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r209328.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-02-12 11:05 ` jakub at gcc dot gnu.org
@ 2015-02-12 11:07 ` jakub at gcc dot gnu.org
  2015-02-12 11:12 ` mark at gcc dot gnu.org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-12 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> Taking.  I think check_format_types needs a small tweak to look thru
> NOP_EXPRs.

Well, more like do some lame VR computation and not warn if the signedness
doesn't really matter.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-12 11:07 ` jakub at gcc dot gnu.org
@ 2015-02-12 11:12 ` mark at gcc dot gnu.org
  2015-02-12 11:33 ` fche at redhat dot com
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mark at gcc dot gnu.org @ 2015-02-12 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

Mark Wielaard <mark at gcc dot gnu.org> changed:

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

--- Comment #5 from Mark Wielaard <mark at gcc dot gnu.org> ---
Note that this also triggers for code that looks just fine to the user:

#include <stdio.h>
#include <inttypes.h>

int
main (int argc, char **argv)
{
  uint8_t u = 16;
  printf ("u = %02" PRIx8 "\n", u);
  return 0;
}

m.c: In function ‘main’:
m.c:8:11: warning: format ‘%x’ expects argument of type ‘unsigned int’, but
argument 2 has type ‘int’ [-Wformat=]
   printf ("u = %02" PRIx8 "\n", u);
           ^

Which is somewhat surprising since the user explicitly matched the type and
format specifier.

This is caused by the definition of the PRIx format specifiers all mapping back
to "x" in inttypes.h

/* lowercase hexadecimal notation.  */
# define PRIx8          "x"
# define PRIx16         "x"
# define PRIx32         "x"
>From gcc-bugs-return-477000-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 12 11:15:10 2015
Return-Path: <gcc-bugs-return-477000-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30230 invoked by alias); 12 Feb 2015 11:15:10 -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 30161 invoked by uid 48); 12 Feb 2015 11:15:06 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/65039] [5 Regression] g++ 5 segmentation fault when compiling with -O2 optimization
Date: Thu, 12 Feb 2015 11:15:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi 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:
Message-ID: <bug-65039-4-1a1sZXTd3w@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65039-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65039-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-02/txt/msg01333.txt.bz2
Content-length: 232

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I reproduced this with an out-of-date trunk build, but using today's trunk it
compiles OK, so seems to be fixed.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-02-12 11:12 ` mark at gcc dot gnu.org
@ 2015-02-12 11:33 ` fche at redhat dot com
  2015-02-13  7:56 ` mpolacek at gcc dot gnu.org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fche at redhat dot com @ 2015-02-12 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #6 from Frank Ch. Eigler <fche at redhat dot com> ---
Note that printf is a varargs function, and is defined to widen
smaller-than-int parameters to at least int.  unsigned short is
subsumed in int.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-02-12 11:33 ` fche at redhat dot com
@ 2015-02-13  7:56 ` mpolacek at gcc dot gnu.org
  2015-02-13  7:57 ` mpolacek at gcc dot gnu.org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-13  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Feb 13 07:56:14 2015
New Revision: 220677

URL: https://gcc.gnu.org/viewcvs?rev=220677&root=gcc&view=rev
Log:
    PR c/65040
    * c-format.c (check_format_types): Don't warn about different
    signedness if the original value is in the range of WANTED_TYPE.

    * c-c++-common/pr65040.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/pr65040.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-format.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-02-13  7:56 ` mpolacek at gcc dot gnu.org
@ 2015-02-13  7:57 ` mpolacek at gcc dot gnu.org
  2015-02-14  9:58 ` jirislaby at gmail dot com
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-13  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Should be better now.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-02-13  7:57 ` mpolacek at gcc dot gnu.org
@ 2015-02-14  9:58 ` jirislaby at gmail dot com
  2015-02-14 10:31 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jirislaby at gmail dot com @ 2015-02-14  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jiri Slaby <jirislaby at gmail dot com> ---
What about this?

#include <stdio.h>

void x(char *ch)
{
        printf("%x\n", ch[10]);
}

It still produces the warning. (I cannot reopen as I am not a reporter.)


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2015-02-14  9:58 ` jirislaby at gmail dot com
@ 2015-02-14 10:31 ` mpolacek at gcc dot gnu.org
  2015-02-14 11:21 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-14 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
That's because on your architecture char is signed by default.  Try adding
"unsigned" or using -funsigned-char and the warning should be gone.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2015-02-14 10:31 ` mpolacek at gcc dot gnu.org
@ 2015-02-14 11:21 ` jakub at gcc dot gnu.org
  2015-02-14 11:21 ` jirislaby at gmail dot com
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-14 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
-funsigned-char is an option that shouldn't be used without serious
consideration.
That said, I think in that case the warning is intentional, you are indeed
passing a signed value to unsigned format.  If you don't care about that, don't
use -Wformat=2 or use -Wno-format-signedness.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2015-02-14 11:21 ` jakub at gcc dot gnu.org
@ 2015-02-14 11:21 ` jirislaby at gmail dot com
  2015-02-16 11:17 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jirislaby at gmail dot com @ 2015-02-14 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jiri Slaby <jirislaby at gmail dot com> ---
(In reply to Marek Polacek from comment #10)
> That's because on your architecture char is signed by default.  Try adding
> "unsigned" or using -funsigned-char and the warning should be gone.

Ok, I wanted to make sure, that the format string is really wrong here. It
should be %hhx.

Ouch, that will be pain to fix all those 400 bad format strings in grub2, given
they use Werror & WFormat :D.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2015-02-14 11:21 ` jirislaby at gmail dot com
@ 2015-02-16 11:17 ` mpolacek at gcc dot gnu.org
  2015-02-24  9:40 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-16 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Note that this patch had a followup: PR65066.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2015-02-16 11:17 ` mpolacek at gcc dot gnu.org
@ 2015-02-24  9:40 ` rguenth at gcc dot gnu.org
  2015-02-24  9:57 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-24  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
#include <stdio.h>
int main()
{
  printf ("%x%u\n", 4, 4);
}
> gcc-5 -Wall t.c -Wformat=2
t.c: In function 'main':
t.c:4:11: warning: format '%x' expects argument of type 'unsigned int', but
argument 2 has type 'int' [-Wformat=]
   printf ("%x%u\n", 4, 4);
           ^
t.c:4:11: warning: format '%u' expects argument of type 'unsigned int', but
argument 3 has type 'int' [-Wformat=]

that's undesirable as well (the constant fits in an unsigned int).


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2015-02-24  9:40 ` rguenth at gcc dot gnu.org
@ 2015-02-24  9:57 ` rguenth at gcc dot gnu.org
  2015-02-24 10:14 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-24  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'd also say that warnings for formats that do not have a signed form are
useless,
thus for %o, %x and %X.  But I guess you beg to differ.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2015-02-24  9:57 ` rguenth at gcc dot gnu.org
@ 2015-02-24 10:14 ` mpolacek at gcc dot gnu.org
  2015-02-24 10:16 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-24 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ok, I can fix the integer constant case as well.

(In reply to Richard Biener from comment #15)
> I'd also say that warnings for formats that do not have a signed form are
> useless,
> thus for %o, %x and %X.  But I guess you beg to differ.

I don't know - it wasn't me who implemented this warning, I'm just doing it
less verbose ;).


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2015-02-24 10:14 ` mpolacek at gcc dot gnu.org
@ 2015-02-24 10:16 ` jakub at gcc dot gnu.org
  2015-02-24 10:22 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-24 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
IMHO the warning is completely useless, but perhaps some people disagree.


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2015-02-24 10:16 ` jakub at gcc dot gnu.org
@ 2015-02-24 10:22 ` rguenth at gcc dot gnu.org
  2015-02-27 15:02 ` mpolacek at gcc dot gnu.org
  2015-02-27 15:03 ` mpolacek at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-24 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
And it was just mentioned that the diagnostic should print

 [-Wformat-signedness]

not

 [-Wformat=]

(or both)


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2015-02-24 10:22 ` rguenth at gcc dot gnu.org
@ 2015-02-27 15:02 ` mpolacek at gcc dot gnu.org
  2015-02-27 15:03 ` mpolacek at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-27 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Feb 27 14:11:53 2015
New Revision: 221061

URL: https://gcc.gnu.org/viewcvs?rev=221061&root=gcc&view=rev
Log:
    PR c/65040
    * doc/invoke.texi: Update to reflect that -Wformat=2 doesn't enable
    -Wformat-signedness anymore.

    * c.opt (Wformat-signedness): Don't enable by -Wformat=2.

    * gcc.dg/pr65066.c: Use -Wformat -Wformat-signedness and not
    -Wformat=2.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr65066.c


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

* [Bug c/65040] [5 Regression] gcc-5 -Wformat broken
  2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2015-02-27 15:02 ` mpolacek at gcc dot gnu.org
@ 2015-02-27 15:03 ` mpolacek at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-27 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #20 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Closing.


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

end of thread, other threads:[~2015-02-27 14:14 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 10:10 [Bug c/65040] New: [5 Regression] gcc-5 -Wformat broken rguenth at gcc dot gnu.org
2015-02-12 10:10 ` [Bug c/65040] " rguenth at gcc dot gnu.org
2015-02-12 10:37 ` mpolacek at gcc dot gnu.org
2015-02-12 10:46 ` mpolacek at gcc dot gnu.org
2015-02-12 11:05 ` jakub at gcc dot gnu.org
2015-02-12 11:07 ` jakub at gcc dot gnu.org
2015-02-12 11:12 ` mark at gcc dot gnu.org
2015-02-12 11:33 ` fche at redhat dot com
2015-02-13  7:56 ` mpolacek at gcc dot gnu.org
2015-02-13  7:57 ` mpolacek at gcc dot gnu.org
2015-02-14  9:58 ` jirislaby at gmail dot com
2015-02-14 10:31 ` mpolacek at gcc dot gnu.org
2015-02-14 11:21 ` jakub at gcc dot gnu.org
2015-02-14 11:21 ` jirislaby at gmail dot com
2015-02-16 11:17 ` mpolacek at gcc dot gnu.org
2015-02-24  9:40 ` rguenth at gcc dot gnu.org
2015-02-24  9:57 ` rguenth at gcc dot gnu.org
2015-02-24 10:14 ` mpolacek at gcc dot gnu.org
2015-02-24 10:16 ` jakub at gcc dot gnu.org
2015-02-24 10:22 ` rguenth at gcc dot gnu.org
2015-02-27 15:02 ` mpolacek at gcc dot gnu.org
2015-02-27 15:03 ` mpolacek 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).