Created attachment 25480 [details] File triggering the crash Compiling the attached (which is from Wine) with -O2, I get file.c: In function 'MSVCRT_vfprintf_s': file.c:4026:1: error: invalid argument to gimple call valist # .MEM_3 = VDEF <.MEM_9(D)> ret_8 = MSVCRT_vfprintf_s.part.7 (file_2(D), format_5(D), valist); file.c:4026:1: internal compiler error: verify_gimple failed This must have happened about three days ago.
Mine, reducing.
Reduced testcase (suspicious because of address-taking of a valist): typedef __builtin_va_list __va_list; typedef __va_list __gnuc_va_list; typedef __gnuc_va_list va_list; struct MSVCRT__iobuf { }; typedef struct MSVCRT__iobuf MSVCRT_FILE; typedef union _printf_arg { } printf_arg; MSVCRT_FILE MSVCRT__iob[20]; int pf_print_a (va_list *); int __attribute__((__cdecl__)) MSVCRT_vfprintf_s(MSVCRT_FILE* file, const char *format, va_list valist) { if(!((file != ((void *)0)) || (MSVCRT__invalid_parameter(((void *)0), ((void *)0), ((void *)0), 0, 0),0))) return -1; return pf_printf_a(&valist); } int __attribute__((__cdecl__)) MSVCRT_vprintf_s(const char *format, va_list valist) { return MSVCRT_vfprintf_s((MSVCRT__iob+1),format,valist); } int __attribute__((__cdecl__)) MSVCRT_fprintf_s(MSVCRT_FILE* file, const char *format, ...) { va_list valist; va_start (valist, format); return MSVCRT_vfprintf_s(file, format, valist); }
More likely caused by adding checking to pass_split_functions. It splits MSVCRT_vfprintf_s (struct MSVCRT_FILE * file, const char * format, char * valist) { int D.2058; <bb 2>: if (file_2(D) == 0B) goto <bb 3>; else goto <bb 4>; <bb 3>: MSVCRT__invalid_parameter (0B, 0B, 0B, 0, 0); goto <bb 5>; <bb 4>: D.2058_4 = pf_printf_a (&valist); <bb 5>: # D.2058_1 = PHI <-1(3), D.2058_4(4)> return D.2058_1; to MSVCRT_vfprintf_s (struct MSVCRT_FILE * file, const char * format, char * valist) { int D.2058; <bb 2>: if (file_2(D) == 0B) goto <bb 3>; else goto <bb 4>; <bb 3>: D.2058_5 = MSVCRT_vfprintf_s.part.0 (file_2(D), format_3(D), valist); goto <bb 5>; <bb 4>: D.2058_4 = pf_printf_a (&valist); <bb 5>: # D.2058_1 = PHI <D.2058_5(3), D.2058_4(4)> return D.2058_1; but fails to realize that for passing the address-taken parameter valist it has to gimplify it.
I have a patch.
Author: rguenth Date: Thu Oct 13 12:07:44 2011 New Revision: 179919 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179919 Log: 2011-10-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/50712 * ipa-split.c (split_function): Always re-gimplify parameters when they are not gimple vals before passing them. Properly check for type compatibility. * gcc.target/i386/pr50712.c: New testcase. Added: trunk/gcc/testsuite/gcc.target/i386/pr50712.c Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-split.c trunk/gcc/testsuite/ChangeLog
Fixed.
Author: rguenth Date: Fri Oct 14 12:17:41 2011 New Revision: 179974 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179974 Log: 2011-10-14 Richard Guenther <rguenther@suse.de> Backport from mainline 2011-10-14 Richard Guenther <rguenther@suse.de> PR tree-optimization/50723 * ipa-split.c (split_function): Use GSI_CONTINUE_LINKING. * gcc.dg/torture/pr50723.c: New testcase. 2011-10-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/50712 * ipa-split.c (split_function): Always re-gimplify parameters when they are not gimple vals before passing them. Properly check for type compatibility. * gcc.target/i386/pr50712.c: New testcase. Added: branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr50723.c branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr50712.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/ipa-split.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog