https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120416
Bug ID: 120416
Summary: unreachable() missing on win32, but not win64
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ossman at cendio dot se
Target Milestone: ---
This test program:
> #include <stddef.h>
>
> int main(int argc, char** argv)
> {
> unreachable();
> return 0;
> }
Compiles for 32-bit MinGW:
> $ i686-pc-mingw32-gcc -o unreach unreach.c
>
But not for 64-bit MinGW:
> $ x86_64-w64-mingw32-gcc -o unreach unreach.c
> unreach.c: In function 'main':
> unreach.c:5:5: error: implicit declaration of function 'unreachable'
> [-Wimplicit-function-declaration]
> 5 | unreachable();
> | ^~~~~~~~~~~
Tested with gcc 15.1.
The technical reason is that for 64-bit, gcc's <stddef.h> has this at the
start:
> #include_next <stddef.h>
This was added in r162479/9b91e4361 for bug 41943. I don't understand why,
though. That bug talks about bogus include paths, not chaining/overriding
headers.
I don't dare revert that commit, though, as MinGW has a very non-trivial
<stddef.h>. So they likely rely on that.
On the other hand, they can't rely too much on it, since the 32-bit version has
worked fine without it.
I think bug 119658 takes a more general approach to this issue, as this
difference between 32-bit and 64-bit is not just for <stddef.h>.