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

            Bug ID: 125226
           Summary: error: conflicting types for ‘__stack_chk_guard’; have
                    ‘long unsigned int’
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86_64-darwin

default_stack_protect_guard calls

        lang_hooks.types.type_for_mode (ptr_mode, 1);

to get an integer type for __stack_chk_guard when it is declared as
a global symbol of type uintptr_t.  For 32-bit systems, uintptr_t may
be either unsigned int or unsigned long int.  Since uintptr_t for 32-bit
Darwin is 32-bit unsigned long int, we get

$ cat /tmp/x.c
__UINTPTR_TYPE__ __stack_chk_guard = 0x1000;
$ ./xgcc -B./ -S /tmp/x.c -m32
/tmp/x.c:1:18: error: conflicting types for ‘__stack_chk_guard’; have ‘long
unsigned int’
    1 | __UINTPTR_TYPE__ __stack_chk_guard = 0x1000;
      |                  ^~~~~~~~~~~~~~~~~
cc1: note: previous declaration of ‘__stack_chk_guard’ with type ‘unsigned int’
$

Reply via email to