public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/2591: variable expression erroneously allowed to dimension array
@ 2001-04-19 14:26 allen.everhart
0 siblings, 0 replies; 2+ messages in thread
From: allen.everhart @ 2001-04-19 14:26 UTC (permalink / raw)
To: gcc-gnats; +Cc: jason.ren
>Number: 2591
>Category: c
>Synopsis: variable expression erroneously allowed to dimension array
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Thu Apr 19 14:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Allen Everhart
>Release: gcc version 2.8.1
>Organization:
>Environment:
AIX 4.2 also is accepted by CodeSorcery
/marces/gnu/lib/gcc-lib/powerpc-ibm-aix4.2.1.0/2.8.1/specs
>Description:
An automatic array is erroneously allowed to be dimensioned by a variable expression. This is an ansi violation and highly nonportable to other ansi compilers.
>How-To-Repeat:
gcc -Wall -ansi variabledimensionedarray.c
>Fix:
compile with xlc and fix syntax errors.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="variabledimensionedarray.txt"
Content-Disposition: inline; filename="variabledimensionedarray.txt"
int printf( char *, ... ) ;
int i=1 ;
int main()
{
char buff[i] ; /* variable expression allowed to dimension array */
buff[0] = 'f' ;
buff[1] = 'o' ;
buff[2] = 'o' ;
buff[3] = '\0' ;
return printf( "%s %d\n", buff, sizeof(buff) ) ;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c/2591: variable expression erroneously allowed to dimension array
@ 2001-04-19 16:06 Toshi Morita
0 siblings, 0 replies; 2+ messages in thread
From: Toshi Morita @ 2001-04-19 16:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/2591; it has been noted by GNATS.
From: Toshi Morita <tm2@best.com>
To: allen.everhart@marcgs.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/2591: variable expression erroneously allowed to dimension array
Date: Thu, 19 Apr 2001 15:58:21 -0700 (PDT)
>
> >Number: 2591
> >Category: c
> >Synopsis: variable expression erroneously allowed to dimension array
> >Confidential: no
> >Severity: serious
> >Priority: high
> >Responsible: unassigned
> >State: open
> >Class: accepts-illegal
> >Submitter-Id: net
> >Arrival-Date: Thu Apr 19 14:26:00 PDT 2001
> >Closed-Date:
> >Last-Modified:
> >Originator: Allen Everhart
> >Release: gcc version 2.8.1
...
> int printf( char *, ... ) ;
> int i=1 ;
>
> int main()
> {
> char buff[i] ; /* variable expression allowed to dimension array */
>
> buff[0] = 'f' ;
> buff[1] = 'o' ;
> buff[2] = 'o' ;
> buff[3] = '\0' ;
> return printf( "%s %d\n", buff, sizeof(buff) ) ;
> }
This is a GNU C extension. If you want to disable GNU C extensions, you should
use -pedantic -ansi, I believe.
Toshi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-04-19 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-19 14:26 c/2591: variable expression erroneously allowed to dimension array allen.everhart
2001-04-19 16:06 Toshi Morita
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).