public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/3711: va_arg + var size struct + typeof crash gcc 3.1
@ 2001-12-15  9:02 rodrigc
  0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2001-12-15  9:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nicola, nobody

Synopsis: va_arg + var size struct + typeof crash gcc 3.1

State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Sat Dec 15 09:02:41 2001
State-Changed-Why:
    With gcc 3.1 20011207, I get the following ICE 
    your code example:
    
    x.c: In function `functionWithArgs':
    x.c:24: Internal compiler error in instantiate_virtual_regs_1, at function.c:3873
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
    
    Problem goes away if I make the char x[] a fixed instead
    of variable size.
    
    Problem does not occur in gcc 3.0.3

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3711


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c/3711: va_arg + var size struct + typeof crash gcc 3.1
@ 2001-07-17  8:36 Nicola Pero
  0 siblings, 0 replies; 2+ messages in thread
From: Nicola Pero @ 2001-07-17  8:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3711
>Category:       c
>Synopsis:       va_arg + var size struct + typeof crash gcc 3.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 17 08:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nicola Pero
>Release:        3.1 20010717
>Organization:
>Environment:
gnu
>Description:
Gcc 3.1 seems to have problems with typeof + va_arg 
+ variable size structs; the code shown crashes gcc-3.1;
it works with the other gcc versions I tried, 
which were gcc-3.0 and gcc-2.91.66.
>How-To-Repeat:
Compile the following code:


#include <stdarg.h>
#include <stdio.h>

/* This function really accepts a size, and then a struct. 
   We use variable args only to show a bug in the compiler. */
void functionWithArgs (int size, ...)
{
  struct 
  {
    char        x[size];
  } dummy;
  va_list ap;
  int i;

  va_start (ap, size);
  dummy = va_arg (ap, typeof(dummy));
  for (i = 0; i < size; i++)
    {
      printf ("%c\n", (dummy.x)[i]);
    }
  va_end (ap);
}

int main (void)
{
  struct 
  {
    char y[5];
  } test;
  
  (test.y)[0] = '1';
  (test.y)[1] = '2';
  (test.y)[2] = '3';
  (test.y)[3] = '4';
  (test.y)[4] = '5';

  functionWithArgs (5, test);
  
  return 0;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-15 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-15  9:02 c/3711: va_arg + var size struct + typeof crash gcc 3.1 rodrigc
  -- strict thread matches above, loose matches on Subject: below --
2001-07-17  8:36 Nicola Pero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).