public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
@ 2012-03-27  7:46 ` rguenth at gcc dot gnu.org
  2012-05-01 20:46 ` jyasskin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-27  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-27 07:43:36 UTC ---
*** Bug 52732 has been marked as a duplicate of this bug. ***


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
  2012-03-27  7:46 ` [Bug c/37743] Bogus printf format warning with __builtin_bswap32 rguenth at gcc dot gnu.org
@ 2012-05-01 20:46 ` jyasskin at gcc dot gnu.org
  2012-05-01 20:47 ` jyasskin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2012-05-01 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey Yasskin <jyasskin at gcc dot gnu.org> changed:

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

--- Comment #7 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2012-05-01 20:45:33 UTC ---
This also causes the result of __builtin_bswap32 to fail overload resolution:

$ cat test.cc
void foo(unsigned int x);
void foo(int x);

void bar(long long x) {
  foo(__builtin_bswap32(x));
}
$ g++-4.8pre -c test.cc
test.cc: In function ‘void bar(long long int)’:
test.cc:5:27: error: call of overloaded ‘foo(unsigned int)’ is ambiguous
test.cc:5:27: note: candidates are:
test.cc:1:6: note: void foo(unsigned int)
test.cc:2:6: note: void foo(int)
$ g++-4.8pre --version
g++-4.8pre (GCC) 4.8.0 20120330 (experimental)


It's not terribly important to me: a wrapper can easily cast to the expected
type.


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
  2012-03-27  7:46 ` [Bug c/37743] Bogus printf format warning with __builtin_bswap32 rguenth at gcc dot gnu.org
  2012-05-01 20:46 ` jyasskin at gcc dot gnu.org
@ 2012-05-01 20:47 ` jyasskin at gcc dot gnu.org
  2013-12-01  1:10 ` hp at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2012-05-01 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2012-05-01 20:47:00 UTC ---
Arguably, the bad diagnostic (reporting "unsigned int!=unsigned int") is more
serious than the bswap bug, since it may show up for other functions.


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-05-01 20:47 ` jyasskin at gcc dot gnu.org
@ 2013-12-01  1:10 ` hp at gcc dot gnu.org
  2014-02-19  6:50 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu.org @ 2013-12-01  1:10 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-03-31 20:40:20         |2013-12-1
                 CC|                            |hp at gcc dot gnu.org

--- Comment #9 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
Not much traffic in this PR.  Anyway, I was about to enter a dup but instead
I'll reconfirm the issue: still happens with r205550 for cris-elf and also 4.7
and 4.8 branches if there was any doubt.


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-12-01  1:10 ` hp at gcc dot gnu.org
@ 2014-02-19  6:50 ` jakub at gcc dot gnu.org
  2014-02-19 17:37 ` joseph at codesourcery dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-19  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Joseph S. Myers from comment #4)
> Because my bug 448 patch isn't complete (doesn't give knowledge of the
> stdint.h types for all targets), it doesn't yet fix this issue; it defines
> c_uint32_type_node and c_uint64_type_node to be the normal C types used
> in stdint.h where those are known to GCC.  Once GCC knows the stdint.h
> types on all targets, we can get rid of the special uint32_type_node
> and uint64_type_node, renaming c_uint32_type_node and c_uint64_type_node
> to those names, and then the built-in function will return a normal C type.

So, can't c_common_nodes_and_builtins at least for now just
  if (UINT32_TYPE)
    uint32_type_node = c_uint32_type_node =
      TREE_TYPE (identifier_global_value (c_get_ident (UINT32_TYPE)));
, etc. (for all the c_*type_node which have middle-end counterparts that are
then used for the builtins)?  That way, this would work at least on the targets
that define the relevant macros.
Or perhaps instead after all the c_*type_node assignments do:
  if (c_uint32_type_node
      && TYPE_PRECISION (c_uint32_type_node) == TYPE_PRECISION
(uint32_type_node)
      && TYPE_UNSIGNED (c_uint32_type_node) == TYPE_PRECISION
(uint32_type_node))
    uint32_type_node = c_uint32_type_node;
(but perhaps that is too much paranoia).


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-02-19  6:50 ` jakub at gcc dot gnu.org
@ 2014-02-19 17:37 ` joseph at codesourcery dot com
  2014-02-19 22:28 ` jakub at gcc dot gnu.org
  2014-03-06  8:11 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 13+ messages in thread
From: joseph at codesourcery dot com @ 2014-02-19 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Yes, we could do something like that (but I also think it's time to put 
the targets without this type information on the deprecation list and warn 
their maintainers that the target support will be removed in the absence 
of this information being added soon).


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-02-19 17:37 ` joseph at codesourcery dot com
@ 2014-02-19 22:28 ` jakub at gcc dot gnu.org
  2014-03-06  8:11 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-19 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Feb 19 22:27:40 2014
New Revision: 207924

URL: http://gcc.gnu.org/viewcvs?rev=207924&root=gcc&view=rev
Log:
    PR c/37743
    * c-common.c (c_common_nodes_and_builtins): When initializing
    c_uint{16,32,64}_type_node, also set corresponding
    uint{16,32,64}_type_node to the same value.

    * g++.dg/ext/builtin-bswap1.C: New test.
    * c-c++-common/pr37743.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/pr37743.c
    trunk/gcc/testsuite/g++.dg/ext/builtin-bswap1.C
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
       [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2014-02-19 22:28 ` jakub at gcc dot gnu.org
@ 2014-03-06  8:11 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-06  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Thu Mar  6 08:11:20 2014
New Revision: 208371

URL: http://gcc.gnu.org/viewcvs?rev=208371&root=gcc&view=rev
Log:
    Backport from mainline
    2014-02-19  Jakub Jelinek  <jakub@redhat.com>

    PR c/37743
    * c-common.c (c_common_nodes_and_builtins): When initializing
    c_uint{16,32,64}_type_node, also set corresponding
    uint{16,32,64}_type_node to the same value.

    * g++.dg/ext/builtin-bswap1.C: New test.
    * c-c++-common/pr37743.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/c-c++-common/pr37743.c
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/ext/builtin-bswap1.C
Modified:
    branches/gcc-4_8-branch/gcc/c-family/ChangeLog
    branches/gcc-4_8-branch/gcc/c-family/c-common.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
  2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
                   ` (3 preceding siblings ...)
  2009-03-31 20:40 ` jsm28 at gcc dot gnu dot org
@ 2010-06-11 14:56 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-06-11 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2010-06-11 14:56 -------
*** Bug 44502 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcczilla1 at achurch dot org


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


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
  2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
                   ` (2 preceding siblings ...)
  2008-10-07 13:24 ` jakub at gcc dot gnu dot org
@ 2009-03-31 20:40 ` jsm28 at gcc dot gnu dot org
  2010-06-11 14:56 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 20:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2009-03-31 20:40 -------
Because my bug 448 patch isn't complete (doesn't give knowledge of the
stdint.h types for all targets), it doesn't yet fix this issue; it defines
c_uint32_type_node and c_uint64_type_node to be the normal C types used
in stdint.h where those are known to GCC.  Once GCC knows the stdint.h
types on all targets, we can get rid of the special uint32_type_node
and uint64_type_node, renaming c_uint32_type_node and c_uint64_type_node
to those names, and then the built-in function will return a normal C type.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-31 20:40:20
               date|                            |


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


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
  2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
  2008-10-06 21:56 ` [Bug c/37743] " pinskia at gcc dot gnu dot org
  2008-10-06 21:57 ` pinskia at gcc dot gnu dot org
@ 2008-10-07 13:24 ` jakub at gcc dot gnu dot org
  2009-03-31 20:40 ` jsm28 at gcc dot gnu dot org
  2010-06-11 14:56 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-07 13:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-10-07 13:22 -------
I think the warning is desirable, the code isn't portable to non-32bit int
targets.  Wonder if we just shouldn't give a TYPE_NAME to uint32_type_node
and uint64_type_node (__builtin_uint32_t and __builtin_uint64_t or something
similar), then c-format would print that instead and the warning would be
clearer.


-- 


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


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
  2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
  2008-10-06 21:56 ` [Bug c/37743] " pinskia at gcc dot gnu dot org
@ 2008-10-06 21:57 ` pinskia at gcc dot gnu dot org
  2008-10-07 13:24 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-06 21:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-10-06 21:56 -------
DEF_FUNCTION_TYPE_1 (BT_FN_UINT32_UINT32, BT_UINT32, BT_UINT32)

DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node)

Instead of using:
DEF_PRIMITIVE_TYPE (BT_UINT, unsigned_type_node)

But we need to use the 32bit type here instead of unsigned_type really ....


-- 


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


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

* [Bug c/37743] Bogus printf format warning with __builtin_bswap32.
  2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
@ 2008-10-06 21:56 ` pinskia at gcc dot gnu dot org
  2008-10-06 21:57 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-06 21:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-10-06 21:55 -------
DEF_GCC_BUILTIN        (BUILT_IN_BSWAP32, "bswap32", BT_FN_UINT32_UINT32,
ATTR_CONST_NOTHROW_LIST)

This is caused by the fact __builtin_bswap32 uses uintSItype instead of the
normal unsignedint types.


-- 


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


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

end of thread, other threads:[~2014-03-06  8:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
2012-03-27  7:46 ` [Bug c/37743] Bogus printf format warning with __builtin_bswap32 rguenth at gcc dot gnu.org
2012-05-01 20:46 ` jyasskin at gcc dot gnu.org
2012-05-01 20:47 ` jyasskin at gcc dot gnu.org
2013-12-01  1:10 ` hp at gcc dot gnu.org
2014-02-19  6:50 ` jakub at gcc dot gnu.org
2014-02-19 17:37 ` joseph at codesourcery dot com
2014-02-19 22:28 ` jakub at gcc dot gnu.org
2014-03-06  8:11 ` jakub at gcc dot gnu.org
2008-10-06  8:12 [Bug c/37743] New: " suckfish at ihug dot co dot nz
2008-10-06 21:56 ` [Bug c/37743] " pinskia at gcc dot gnu dot org
2008-10-06 21:57 ` pinskia at gcc dot gnu dot org
2008-10-07 13:24 ` jakub at gcc dot gnu dot org
2009-03-31 20:40 ` jsm28 at gcc dot gnu dot org
2010-06-11 14:56 ` pinskia at gcc dot gnu dot 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).