public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/7118: Compiler generates code that cannot be executed.
@ 2002-06-25  8:34 mhdecoursey
  0 siblings, 0 replies; 2+ messages in thread
From: mhdecoursey @ 2002-06-25  8:34 UTC (permalink / raw)
  To: gcc-gnats; +Cc: markhdecoursey


>Number:         7118
>Category:       other
>Synopsis:       Compiler generates code that cannot be executed.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 25 08:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mark DeCoursey
>Release:        2.9-gnupro-99r1
>Organization:
>Environment:

>Description:
The following code compiles without error or warning,
and generates a program that will not run on my Sun Blade.  
It crashes with a SEGV on first instruction.

The cause is obvious.  In GDB, set a break on main.  Before
executing any instructions, examine the values for a, b,
c, d, e, and f.

A single step in the debugger causes the SEGV. 

Luckily I was able to find the problem with only an hour's 
work.  With a more complex program, I might have lost days.

int
main(
     int argc,
     char* argv[]
     )
{
  int a = 5;
  int b = 6;
  int c = 7;
  int array[1000000];
  int d = 8;
  int e = 9;
  int f;

  f = a + b + c + d + e;
  array[1] = f;

  return( 0 );
}
>How-To-Repeat:
Compile the above code with -g.  No header files are required.
	
>Fix:
I realize it may not be possible to test the system when
generating the program, but a warning should be issued when
an excessively large array is encountered.  

The ideal of course would be to compute on installation what 
the system could tolerate, and build that into a compiler 
parameter.

But if wishes were compilers, beggars would write code, and
then where would we be?
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: other/7118: Compiler generates code that cannot be executed.
@ 2002-06-25  8:56 davem
  0 siblings, 0 replies; 2+ messages in thread
From: davem @ 2002-06-25  8:56 UTC (permalink / raw)
  To: davem, gcc-bugs, gcc-prs, markhdecoursey, mhdecoursey, nobody

Synopsis: Compiler generates code that cannot be executed.

Responsible-Changed-From-To: unassigned->davem
Responsible-Changed-By: davem
Responsible-Changed-When: Tue Jun 25 08:38:40 2002
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->closed
State-Changed-By: davem
State-Changed-When: Tue Jun 25 08:38:40 2002
State-Changed-Why:
    2.9-gnupro is a commercial release of GCC, this bug report
    does not belong here it belongs with the vendor you obtained
    that version of the compiler from.
    
    Secondly, I cannot reproduce your problem on Solaris-2.8 with
    current versions (3.1) of GCC.

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


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

end of thread, other threads:[~2002-06-25 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-25  8:34 other/7118: Compiler generates code that cannot be executed mhdecoursey
2002-06-25  8:56 davem

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).