public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
@ 2023-01-06  3:59 egallager at gcc dot gnu.org
  2023-01-06  4:06 ` [Bug c/108310] " egallager at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-01-06  3:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108310
           Summary: Some warnings that -Wtraditional-conversion causes to
                    be emitted aren't actually controlled by it
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic, easyhack
          Severity: trivial
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egallager at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

So, I'm having trouble crafting a testcase that properly reproduces this issue,
but let's see if we can do this just by looking at the source: in
gcc/c/c-typeck.cc, starting at line 3464 (as it currently exists), there is a
block of code that emits some warnings from -Wtraditional-conversion:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/c-typeck.cc;h=e06f052eb46a72d3d50835330c5af975e7c52084;hb=HEAD#l3464
However, instead of being called like:
warning_at (ploc, OPT_Wtraditional_conversion, "");
like the rest of the warnings in the area, these two are just called like:
warning_at (ploc, 0, "");
This means that when the warning actually gets printed, the flag controlling
it, [-Wtraditional-conversion], isn't actually printed alongside it. `git
blame` says that Martin Sebor was the last person to touch this code in
r9-4484-g550dfbdcf6d93d. I might be able to fix this myself if someone can
confirm for me that this is an actual mistake that ought to be fixed (of
course, anyone else is welcome to fix it first!).

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
@ 2023-01-06  4:06 ` egallager at gcc dot gnu.org
  2023-01-06  4:16 ` egallager at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-01-06  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103210
             Blocks|                            |44209

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Kinda related to bug 103210, IMO, in that I've uncovered both of them by
building my fork of gdb with gcc: https://github.com/cooljeanius/apple-gdb-1824
And, they're also both examples of places where warnings in gcc/c/c-typeck.cc
have a "0" for the second argument where they really ought to have an option
name instead, as per bug 44209.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
  2023-01-06  4:06 ` [Bug c/108310] " egallager at gcc dot gnu.org
@ 2023-01-06  4:16 ` egallager at gcc dot gnu.org
  2023-01-12 14:59 ` egallager at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-01-06  4:16 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=93082

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #1)
> Kinda related to bug 103210, IMO, in that I've uncovered both of them by
> building my fork of gdb with gcc:
> https://github.com/cooljeanius/apple-gdb-1824

More-specific link: https://github.com/cooljeanius/apple-gdb-1824/issues/8
(as the warnings in this bug can be seen preceding the error in question in
that bug, which is related to bug 93082)

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
  2023-01-06  4:06 ` [Bug c/108310] " egallager at gcc dot gnu.org
  2023-01-06  4:16 ` egallager at gcc dot gnu.org
@ 2023-01-12 14:59 ` egallager at gcc dot gnu.org
  2023-01-12 15:13 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-01-12 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #0)
> So, I'm having trouble crafting a testcase that properly reproduces this
> issue, but...

...for reference, this is what I've got so far:

$ cat Wtraditional_conversion_darwin.c
#include <architecture/byte_order.h>
#include <sys/types.h>
#include <inttypes.h>

uint32_t foo(float x)
{
        return OSSwapHostToLittleInt32(x);
}

int32_t bar(double x)
{
        return OSSwapHostToBigInt32(x);
}
$

Unfortunately, the only warning that it produces so far *is* actually
controlled by -Wtraditional-conversion properly, so it's not an example of this
bug (yet):

$ /usr/local/bin/gcc -c -Wall -Wextra -pedantic -Wtraditional-conversion
Wtraditional_conversion_darwin.c
In file included from
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSByteOrder.h:33,
                 from
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/architecture/byte_order.h:38,
                 from Wtraditional_conversion_darwin.c:1:
Wtraditional_conversion_darwin.c: In function 'bar':
Wtraditional_conversion_darwin.c:12:37: warning: passing argument 1 of
'_OSSwapInt32' as integer rather than floating due to prototype
[-Wtraditional-conversion]
   12 |         return OSSwapHostToBigInt32(x);
      |                                     ^
$

ref:
https://github.com/cooljeanius/gcc_bugs/blob/master/Wtraditional_conversion_darwin.c

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-12 14:59 ` egallager at gcc dot gnu.org
@ 2023-01-12 15:13 ` redi at gcc dot gnu.org
  2023-08-07 22:28 ` egallager at gcc dot gnu.org
  2023-08-25 13:34 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-12 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
void f(float);

void g()
{
  f(1.0);
}

conv.c: In function ‘g’:
conv.c:5:5: warning: passing argument 1 of ‘f’ as ‘float’ rather than ‘double’
due to prototype
    5 |   f(1.0);
      |     ^~~

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-12 15:13 ` redi at gcc dot gnu.org
@ 2023-08-07 22:28 ` egallager at gcc dot gnu.org
  2023-08-25 13:34 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-08-07 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> void f(float);
> 
> void g()
> {
>   f(1.0);
> }
> 
> conv.c: In function ‘g’:
> conv.c:5:5: warning: passing argument 1 of ‘f’ as ‘float’ rather than
> ‘double’ due to prototype
>     5 |   f(1.0);
>       |     ^~~

Thanks, which testsuite subdirectory would this go in?

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

* [Bug c/108310] Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it
  2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-08-07 22:28 ` egallager at gcc dot gnu.org
@ 2023-08-25 13:34 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-08-25 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-08-25
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |egallager at gcc dot gnu.org

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
I think I might be able to figure this out myself

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

end of thread, other threads:[~2023-08-25 13:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06  3:59 [Bug c/108310] New: Some warnings that -Wtraditional-conversion causes to be emitted aren't actually controlled by it egallager at gcc dot gnu.org
2023-01-06  4:06 ` [Bug c/108310] " egallager at gcc dot gnu.org
2023-01-06  4:16 ` egallager at gcc dot gnu.org
2023-01-12 14:59 ` egallager at gcc dot gnu.org
2023-01-12 15:13 ` redi at gcc dot gnu.org
2023-08-07 22:28 ` egallager at gcc dot gnu.org
2023-08-25 13:34 ` egallager 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).