delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/28/19:26:18

Date: Mon, 29 Jan 1996 00:14:50 +0000 (GMT)
From: Andy Molyneux <molyneua AT cs DOT man DOT ac DOT uk>
To: djgpp AT delorie DOT com
Subject: Compiler abort!

The following short fragment of code causes GCC 2.6.3 (as supplied with 
DJGPP V2 beta3) to "Abort!" with the following command line:

gcc test.c -c -O

Any type of -O causes this (-O, -O1, -O2, etc...)

Here's the code:

typedef struct {
   int x,y;
} Screen_Point;

void test_abort (Screen_Point pt1, Screen_Point pt2) {
   Screen_Point temp;
   
   if(pt1.x==32767 || pt2.x==32767) return;
   if (pt1.y > pt2.y) {
      temp = pt1;
      pt1 = pt2;
      pt2 = temp;
   }
}

That's the smallest fragment of code I've found that reproduces this bug.
Which brings me to my point... is this a bug in the compiler? It seems to 
work on GCC 2.6.3 on SunOS 4.1, but not on DJGPP. Could it be something 
to do with code generation strategies specifically for 386 code?

If this is a bug, please consider it reported (!). Otherwise, can anyone 
suggest what might be wrong with this code which could have caused it?

TIA,

- Andy

| Andrew Molyneux            Internet: molyneua AT cs DOT man DOT ac DOT uk
| University of Manchester   Tel     : (+44)161-485-3291
| REAL programmers write  a=b!=4?b%2?c:d:e  without even
| thinking about it :-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019