public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c
@ 2023-03-26 22:58 jdx at o2 dot pl
  2023-03-27  0:14 ` [Bug libgcc/109289] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jdx at o2 dot pl @ 2023-03-26 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109289
           Summary: Conflicting types for built-in functions in
                    libgcc/emutls.c
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jdx at o2 dot pl
  Target Milestone: ---

Created attachment 54759
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54759&action=edit
Proposed patch

For different hosts (Windows/MSYS2, Linux), different targets and for every
libgcc variant, the following messages are reported:

/d/Works/xcomp/gcc-build/./gcc/xgcc -B/d/Works/xcomp/gcc-build/./gcc/
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-isystem /d/Works/xcomp/sysroot/h8300-elf/include -ms -O2  -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -DIN_GCC -fPIC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition 
-isystem ./include  -DDF=SF -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector -Dinhibit_libc -DDF=SF -I. -I. -I../../.././gcc
-I../../../../../gcc/libgcc -I../../../../../gcc/libgcc/.
-I../../../../../gcc/libgcc/../gcc -I../../../../../gcc/libgcc/../include    
-o emutls.o -MT emutls.o -MD -MP -MF emutls.dep -fexceptions -c
../../../../../gcc/libgcc/emutls.c -fvisibility=hidden -DHIDE_EXPORTS
d:\works\gcc\libgcc\emutls.c:61:7: warning: conflicting types for built-in
function '__emutls_get_address'; expected 'void *(void *)'
[-Wbuiltin-declaration-mismatch]
   61 | void *__emutls_get_address (struct __emutls_object *);
      |       ^~~~~~~~~~~~~~~~~~~~
d:\works\gcc\libgcc\emutls.c:63:6: warning: conflicting types for built-in
function '__emutls_register_common'; expected 'void(void *, long unsigned int, 
long unsigned int,  void *)' [-Wbuiltin-declaration-mismatch]
   63 | void __emutls_register_common (struct __emutls_object *, word, word,
void *);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
d:\works\gcc\libgcc\emutls.c:140:1: warning: conflicting types for built-in
function '__emutls_get_address'; expected 'void *(void *)'
[-Wbuiltin-declaration-mismatch]
  140 | __emutls_get_address (struct __emutls_object *obj)
      | ^~~~~~~~~~~~~~~~~~~~
d:\works\gcc\libgcc\emutls.c:204:1: warning: conflicting types for built-in
function '__emutls_register_common'; expected 'void(void *, long unsigned int, 
long unsigned int,  void *)' [-Wbuiltin-declaration-mismatch]
  204 | __emutls_register_common (struct __emutls_object *obj,
      | ^~~~~~~~~~~~~~~~~~~~~~~~


Judging by the comment on line 138 the problem is known and acceptable,
therefore IMO it would be nice to mute the warnings by wrapping
declarations/definitions of these functions with "#pragma GCC diagnostic" e.g.
as shown in the attached patch.

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
@ 2023-03-27  0:14 ` pinskia at gcc dot gnu.org
  2023-12-01  9:53 ` tschwinge at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-27  0:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patches should be sent to gcc-patches@ after reading
https://gcc.gnu.org/contribute.html

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
  2023-03-27  0:14 ` [Bug libgcc/109289] " pinskia at gcc dot gnu.org
@ 2023-12-01  9:53 ` tschwinge at gcc dot gnu.org
  2023-12-01 10:17 ` fw at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-12-01  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-12-01
                 CC|                            |ams at gcc dot gnu.org,
                   |                            |fw at gcc dot gnu.org,
                   |                            |jules at gcc dot gnu.org,
                   |                            |tschwinge at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Similarly seen for GCN target, and this is now fatal after Florian's recent
changes (I presume -- and I fully do support those, for avoidance of doubt):

    [...]/source-gcc/libgcc/emutls.c:61:7: warning: conflicting types for
built-in function ‘__emutls_get_address’; expected ‘void *(void *)’
[-Wbuiltin-declaration-mismatch]
       61 | void *__emutls_get_address (struct __emutls_object *);
          |       ^~~~~~~~~~~~~~~~~~~~
    [...]/source-gcc/libgcc/emutls.c:63:6: warning: conflicting types for
built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned
int,  unsigned int,  void *)’ [-Wbuiltin-declaration-mismatch]
       63 | void __emutls_register_common (struct __emutls_object *, word,
word, void *);
          |      ^~~~~~~~~~~~~~~~~~~~~~~~
    [...]/source-gcc/libgcc/emutls.c:140:1: warning: conflicting types for
built-in function ‘__emutls_get_address’; expected ‘void *(void *)’
[-Wbuiltin-declaration-mismatch]
      140 | __emutls_get_address (struct __emutls_object *obj)
          | ^~~~~~~~~~~~~~~~~~~~
    [...]/source-gcc/libgcc/emutls.c: In function ‘__emutls_get_address’:
    [...]/source-gcc/libgcc/emutls.c:172:13: error: implicit declaration of
function ‘calloc’ [-Wimplicit-function-declaration]
      172 |       arr = calloc (size + 1, sizeof (void *));
          |             ^~~~~~
    [...]/source-gcc/libgcc/emutls.c:32:1: note: include ‘<stdlib.h>’ or
provide a declaration of ‘calloc’
       31 | #include "gthr.h"
      +++ |+#include <stdlib.h>
       32 |
    [...]/source-gcc/libgcc/emutls.c:172:13: warning: incompatible implicit
declaration of built-in function ‘calloc’ [-Wbuiltin-declaration-mismatch]
      172 |       arr = calloc (size + 1, sizeof (void *));
          |             ^~~~~~
    [...]/source-gcc/libgcc/emutls.c:172:13: note: include ‘<stdlib.h>’ or
provide a declaration of ‘calloc’
    [...]/source-gcc/libgcc/emutls.c:184:13: error: implicit declaration of
function ‘realloc’ [-Wimplicit-function-declaration]
      184 |       arr = realloc (arr, (size + 1) * sizeof (void *));
          |             ^~~~~~~
    [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
provide a declaration of ‘realloc’
    [...]/source-gcc/libgcc/emutls.c:184:13: warning: incompatible implicit
declaration of built-in function ‘realloc’ [-Wbuiltin-declaration-mismatch]
    [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
provide a declaration of ‘realloc’
    [...]/source-gcc/libgcc/emutls.c: At top level:
    [...]/source-gcc/libgcc/emutls.c:204:1: warning: conflicting types for
built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned
int,  unsigned int,  void *)’ [-Wbuiltin-declaration-mismatch]
      204 | __emutls_register_common (struct __emutls_object *obj,
          | ^~~~~~~~~~~~~~~~~~~~~~~~
    make[2]: *** [[...]/source-gcc/libgcc/static-object.mk:17: emutls.o] Error
1

GCC's suggestion to "include ‘<stdlib.h>’" needs to be carefully reviewed, in
case this is meant to be buildable in an environment without C library headers?

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
  2023-03-27  0:14 ` [Bug libgcc/109289] " pinskia at gcc dot gnu.org
  2023-12-01  9:53 ` tschwinge at gcc dot gnu.org
@ 2023-12-01 10:17 ` fw at gcc dot gnu.org
  2023-12-02 12:24 ` fw at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-01 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Florian Weimer <fw at gcc dot gnu.org> ---
Jan, do you actually experience a build failure? The part you quoted only shows
warnings.

Thomas, the safe thing to do would be to use __builtin_calloc and
__builtin_realloc in those spots because it avoids a dependency on an external
header that might not exist at this point.

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (2 preceding siblings ...)
  2023-12-01 10:17 ` fw at gcc dot gnu.org
@ 2023-12-02 12:24 ` fw at gcc dot gnu.org
  2023-12-02 23:00 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-02 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> ---
What I can I do here to help? What's an easy emutls target to build?

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (3 preceding siblings ...)
  2023-12-02 12:24 ` fw at gcc dot gnu.org
@ 2023-12-02 23:00 ` pinskia at gcc dot gnu.org
  2023-12-03  4:09 ` jdx at o2 dot pl
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-02 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #4)
> What I can I do here to help? What's an easy emutls target to build?

--disable-tls is enough to get the warning while building libgcc on
x86_64-linux-gnu:

/home/apinski/src/upstream-gcc-match/gcc/libgcc/emutls.c:61:7: warning:
conflicting types for built-in function ‘__emutls_get_address’; expected ‘void
*(void *)’ [-Wbuiltin-declaration-mismatch]
   61 | void *__emutls_get_address (struct __emutls_object *);
      |       ^~~~~~~~~~~~~~~~~~~~
/home/apinski/src/upstream-gcc-match/gcc/libgcc/emutls.c:63:6: warning:
conflicting types for built-in function ‘__emutls_register_common’; expected
‘void(void *, unsigned int,  unsigned int,  void *)’
[-Wbuiltin-declaration-mismatch]
   63 | void __emutls_register_common (struct __emutls_object *, word, word,
void *);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/home/apinski/src/upstream-gcc-match/gcc/libgcc/emutls.c:140:1: warning:
conflicting types for built-in function ‘__emutls_get_address’; expected ‘void
*(void *)’ [-Wbuiltin-declaration-mismatch]
  140 | __emutls_get_address (struct __emutls_object *obj)
      | ^~~~~~~~~~~~~~~~~~~~
/home/apinski/src/upstream-gcc-match/gcc/libgcc/emutls.c:204:1: warning:
conflicting types for built-in function ‘__emutls_register_common’; expected
‘void(void *, unsigned int,  unsigned int,  void *)’
[-Wbuiltin-declaration-mismatch]
  204 | __emutls_register_common (struct __emutls_object *obj,
      | ^~~~~~~~~~~~~~~~~~~~~~~~

The build does not fail.

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (4 preceding siblings ...)
  2023-12-02 23:00 ` pinskia at gcc dot gnu.org
@ 2023-12-03  4:09 ` jdx at o2 dot pl
  2023-12-05 16:41 ` tschwinge at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jdx at o2 dot pl @ 2023-12-03  4:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jan Dubiec <jdx at o2 dot pl> ---
(In reply to Florian Weimer from comment #3)
> Jan, do you actually experience a build failure? The part you quoted only
> shows warnings.
Florian, it used to be just the warnings, but now (commit 1461b431) I am not
even able to reach emutls.c:
[...]
rm -rf libcommon.a
ar  rc libcommon.a diagnostic-spec.o diagnostic.o diagnostic-color.o
diagnostic-format-json.o diagnostic-format-sarif.o diagnostic-show-locus.o
edit-context.o pretty-print.o intl.o json.o sbitmap.o vec.o input.o
hash-table.o ggc-none.o memory-block.o selftest.o selftest-diagnostic.o sort.o
text-art/box-drawing.o text-art/canvas.o text-art/ruler.o text-art/selftests.o
text-art/style.o text-art/styled-string.o text-art/table.o text-art/theme.o
text-art/widget.o
ranlib   libcommon.a
make[2]: *** No rule to make target '../libiberty/pic/libiberty.a', needed by
'cc1-checksum.cc'.  Stop.
make[2]: Leaving directory '/d/works/xcomp/gcc-build/gcc'
make[1]: *** [Makefile:4645: all-gcc] Error 2
make[1]: Leaving directory '/d/works/xcomp/gcc-build'
make: *** [Makefile:1048: all] Error 2

Host: Windows/MSYS2, targets: ARM and H8

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (5 preceding siblings ...)
  2023-12-03  4:09 ` jdx at o2 dot pl
@ 2023-12-05 16:41 ` tschwinge at gcc dot gnu.org
  2023-12-06 11:03 ` tschwinge at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-12-05 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Created attachment 56805
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56805&action=edit
'0001-WIP-GCC-PR109289-Conflicting-types-for-built-in-func.patch'

Attaching my current WIP patch.  I may later bring this to completion
(properly), unless anyone gets there first.

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (6 preceding siblings ...)
  2023-12-05 16:41 ` tschwinge at gcc dot gnu.org
@ 2023-12-06 11:03 ` tschwinge at gcc dot gnu.org
  2023-12-06 11:27 ` cvs-commit at gcc dot gnu.org
  2023-12-06 12:53 ` tschwinge at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-12-06 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

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

--- Comment #8 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to myself from comment #2)
>     [...]/source-gcc/libgcc/emutls.c: In function ‘__emutls_get_address’:
>     [...]/source-gcc/libgcc/emutls.c:172:13: error: implicit declaration of
> function ‘calloc’ [-Wimplicit-function-declaration]
>       172 |       arr = calloc (size + 1, sizeof (void *));
>           |             ^~~~~~
>     [...]/source-gcc/libgcc/emutls.c:32:1: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘calloc’
>        31 | #include "gthr.h"
>       +++ |+#include <stdlib.h>
>        32 |
>     [...]/source-gcc/libgcc/emutls.c:172:13: warning: incompatible implicit
> declaration of built-in function ‘calloc’ [-Wbuiltin-declaration-mismatch]
>       172 |       arr = calloc (size + 1, sizeof (void *));
>           |             ^~~~~~
>     [...]/source-gcc/libgcc/emutls.c:172:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘calloc’
>     [...]/source-gcc/libgcc/emutls.c:184:13: error: implicit declaration of
> function ‘realloc’ [-Wimplicit-function-declaration]
>       184 |       arr = realloc (arr, (size + 1) * sizeof (void *));
>           |             ^~~~~~~
>     [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘realloc’
>     [...]/source-gcc/libgcc/emutls.c:184:13: warning: incompatible implicit
> declaration of built-in function ‘realloc’ [-Wbuiltin-declaration-mismatch]
>     [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘realloc’

> GCC's suggestion to "include ‘<stdlib.h>’" needs to be carefully reviewed,
> in case this is meant to be buildable in an environment without C library
> headers?

(In reply to Florian Weimer from comment #3)
> Thomas, the safe thing to do would be to use __builtin_calloc and
> __builtin_realloc in those spots because it avoids a dependency on an
> external header that might not exist at this point.

That part got resolved differently, in commit
r14-6207-g6e84dafcc72d1cd6d028b42f1801e092a91d3214 "tsystem.h: Declare
calloc/realloc #ifdef inhibit_libc".

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (7 preceding siblings ...)
  2023-12-06 11:03 ` tschwinge at gcc dot gnu.org
@ 2023-12-06 11:27 ` cvs-commit at gcc dot gnu.org
  2023-12-06 12:53 ` tschwinge at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-06 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:d7ceffab96ecd021d3e869dff33d0ad4b8577c4f

commit r14-6218-gd7ceffab96ecd021d3e869dff33d0ad4b8577c4f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Dec 6 12:27:12 2023 +0100

    libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c

    When libgcc is being built in --disable-tls configuration or on
    a target without native TLS support, one gets annoying warnings:
    ../../../../libgcc/emutls.c:61:7: warning: conflicting types for built-in
function â__emutls_get_addressâ; expected âvoid *(void *)â
[-Wbuiltin-declaration-mismatch]
       61 | void *__emutls_get_address (struct __emutls_object *);
          |       ^~~~~~~~~~~~~~~~~~~~
    ../../../../libgcc/emutls.c:63:6: warning: conflicting types for built-in
function â__emutls_register_commonâ; expected âvoid(void *, unsigned int,
 unsigned int,  void *)â
    +[-Wbuiltin-declaration-mismatch]
       63 | void __emutls_register_common (struct __emutls_object *, word,
word, void *);
          |      ^~~~~~~~~~~~~~~~~~~~~~~~
    ../../../../libgcc/emutls.c:140:1: warning: conflicting types for built-in
function â__emutls_get_addressâ; expected âvoid *(void *)â
[-Wbuiltin-declaration-mismatch]
      140 | __emutls_get_address (struct __emutls_object *obj)
          | ^~~~~~~~~~~~~~~~~~~~
    ../../../../libgcc/emutls.c:204:1: warning: conflicting types for built-in
function â__emutls_register_commonâ; expected âvoid(void *, unsigned int,
 unsigned int,  void *)â
    +[-Wbuiltin-declaration-mismatch]
      204 | __emutls_register_common (struct __emutls_object *obj,
          | ^~~~~~~~~~~~~~~~~~~~~~~~
    The thing is that in that case __emutls_get_address and
    __emutls_register_common are builtins, and are declared with void *
    arguments rather than struct __emutls_object *.
    Now, struct __emutls_object is a type private to libgcc/emutls.c and the
    middle-end creates on demand when calling the builtins a similar structure
    (with small differences, like not having the union in there).

    We have a precedent for this e.g. for fprintf or strftime builtins where
    the builtins are created with magic fileptr_type_node or
const_tm_ptr_type_node
    types and then match it with user definition of pointers to some structure,
    but I think for this case users should never define these functions
    themselves nor call them and having special types for them in the compiler
    would mean extra compile time spent during compiler initialization and more
    GC data, so I think it is better to keep the compiler as is.

    On the library side, there is an option to just follow what the
    compiler is doing and do
     EMUTLS_ATTR void
    -__emutls_register_common (struct __emutls_object *obj,
    +__emutls_register_common (void *xobj,
                               word size, word align, void *templ)
     {
    +  struct __emutls_object *obj = (struct __emutls_object *) xobj;
    but that will make e.g. libabigail complain about ABI change in libgcc.

    So, the patch just turns the warning off.

    2023-12-06  Thomas Schwinge  <thomas@codesourcery.com>
                Jakub Jelinek  <jakub@redhat.com>

            PR libgcc/109289
            * emutls.c: Add GCC diagnostic ignored
"-Wbuiltin-declaration-mismatch"
            pragma.

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

* [Bug libgcc/109289] Conflicting types for built-in functions in libgcc/emutls.c
  2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
                   ` (8 preceding siblings ...)
  2023-12-06 11:27 ` cvs-commit at gcc dot gnu.org
@ 2023-12-06 12:53 ` tschwinge at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-12-06 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to myself from comment #2)
> Similarly seen for GCN target, and this is now fatal

Actually, sorry, that's not accurate; the "warning: conflicting types" didn't
turn fatal.

Anyway: 'libgcc/emutls.c' should now be clean to build; please re-open if not.

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

end of thread, other threads:[~2023-12-06 12:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 22:58 [Bug libgcc/109289] New: Conflicting types for built-in functions in libgcc/emutls.c jdx at o2 dot pl
2023-03-27  0:14 ` [Bug libgcc/109289] " pinskia at gcc dot gnu.org
2023-12-01  9:53 ` tschwinge at gcc dot gnu.org
2023-12-01 10:17 ` fw at gcc dot gnu.org
2023-12-02 12:24 ` fw at gcc dot gnu.org
2023-12-02 23:00 ` pinskia at gcc dot gnu.org
2023-12-03  4:09 ` jdx at o2 dot pl
2023-12-05 16:41 ` tschwinge at gcc dot gnu.org
2023-12-06 11:03 ` tschwinge at gcc dot gnu.org
2023-12-06 11:27 ` cvs-commit at gcc dot gnu.org
2023-12-06 12:53 ` tschwinge 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).