https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102548
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Summary|gcc segmentation fault in |[9/10/11/12 Regression] ICE |cc1plus (with repro case) |with cdecl attribute on a | |builtin function Target Milestone|--- |9.5 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- sometime between GCC 6 and GCC 7, the ICE was introduced before this was rejected: <source>: In function 'void f()': <source>:12:35: error: invalid conversion from 'size_t (__attribute__((__cdecl__)) *)(char*, size_t, const char*, const tm*) {aka unsigned int (__attribute__((__cdecl__)) *)(char*, unsigned int, const char*, const tm*)}' to 'T {aka unsigned int (__attribute__((__stdcall__)) *)(char*, unsigned int, const char*, const tm*)}' [-fpermissive] static T strftime = loadStrftime(); ~~~~~~~~~~~~^~ Note using auto instead of the type T, the ICE shows up still: typedef decltype(sizeof(0)) size_t; struct tm; extern "C" size_t __attribute__((__cdecl__)) strftime(char * _Buf,size_t _SizeInBytes,const char * _Format,const struct tm * _Tm); void f(void) { auto g = strftime; } And was accepted in GCC 6. So this is a regression from GCC6. Looks like it has to do with builtin functions too.