Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: davids@bduxpe (Peter Davids)
Subject: Compiler Bug
Date: 26 Jul 90 05:41:13 GMT	[thread overview]
Message-ID: <3152@rwthinf.UUCP> (raw)



Some days (or weeks) ago, there was a posting in comp.sys.dec or
comp.unix.ultrix that described a compiler bug in Ultrix CC.

We have DEC 3100 Workstation with Ultrix 3.1 and UWS 2.1 running.
The following little (and correct!?) C-program gives different results,
depending on the optimizer options.
The programm look a bit like the own posted some time ago...


====cut here==============================
char *   malloc();

main()
{
  char *   ba;
  int i=3;
  printf("%d\n", i*(-6) );
  ba = malloc (100);
  printf("%d\n", i*(-6) );
}

/*
 *   Results: 
 *   
 *   Compile with:	'cc b.c'		default
 *   
 *   -18
 *   18
 *   
 *   
 *    
 *   Compile with:	'cc -O  b.c'		optimize
 *   
 *   -18
 *   -18
 *   
 *   
 *   
 *   Compile with:	'cc -O0 b.c'		don't optimize
 *   
 *   18
 *   18
 *   
 *
 */
=====================================================================

Questions

	o	Does anybody know the reasons for this behaviour
	o	Are results the same unter Ultrix 3.0 or 4.0
		(we only have 3.1)
	o	Is there any solution around that problem.


I will be happy about any idea or answer (other bugs would be also
very interesting)

--
_________________________________________________________________________
Peter Davids   Lehrstuhl fuer Informatik IV   RWTH Aachen   D-5100 Aachen
Tel. +241-804522    Fax: +241-806295     davids@informatik.rwth-aachen.de


             reply	other threads:[~1990-07-26  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-07-26  5:41 Peter Davids [this message]
1990-07-26 13:50 ` Compiler Bug Jim Gettys
1990-07-27 15:29 ` Steve V. Hodsdon
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox