Bug 42543 - ICE when using va_arg
Summary: ICE when using va_arg
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2009-12-29 17:07 UTC by Arnaud Kodeck
Modified: 2009-12-31 16:52 UTC (History)
4 users (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-12-31 16:52:54


Attachments
Source file where the bug occured (754 bytes, text/plain)
2009-12-29 17:09 UTC, Arnaud Kodeck
Details
The preprocessed file (3.18 KB, text/plain)
2009-12-29 17:10 UTC, Arnaud Kodeck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud Kodeck 2009-12-29 17:07:12 UTC
Hello,

In the past, I was using gcc 3.4.5 and the code was compiled well. I changed my gcc to version 4.4.1 and this internal compiler occured :
main.c:56: internal compiler error: in gimplify_expr, at gimplify.c:7098

That might be helpfull for you,

Arnaud
Comment 1 Arnaud Kodeck 2009-12-29 17:09:34 UTC
Created attachment 19417 [details]
Source file where the bug occured
Comment 2 Arnaud Kodeck 2009-12-29 17:10:19 UTC
Created attachment 19418 [details]
The preprocessed file
Comment 3 Andrew Pinski 2009-12-29 17:17:08 UTC
The trunk still ICEs:
gimplification failed:
(char *) args2.4 <nop_expr 0x43600ab8
t.c:56:40: internal compiler error: gimplification failed
Please submit a full bug report,

That is an ICE with i686-darwin.  But I think it will also ICE on GNU/Linux too.
Comment 4 H.J. Lu 2009-12-29 17:32:15 UTC
I am not sure if

---
char* FormatStringEx (char str[], size_t max_length, char templ[],
   void* args, unsigned int flags)

{
...
void           *args2;
char           *arg,c;
...
while (index-- > 0 && (arg=va_arg((va_list)args2,char*)) != NULL) ;
...
---

is valid C. But gcc could do better to recover.
Comment 5 H.J. Lu 2009-12-29 17:33:48 UTC
Icc 11.1 generates:

[hjl@gnu-6 rrs]$ /opt/intel/Compiler/11.1/059/bin/intel64/icc -S pr42543.c
pr42543.c(55): error: cast to type "va_list" is not allowed
              while (index-- > 0 && (arg=va_arg((va_list)args2,char*)) != NULL) ;
                                         ^

compilation aborted for pr42543.c (code 2)
[hjl@gnu-6 rrs]$