Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Compiler Bug
@ 1990-07-26  5:41 Peter Davids
  1990-07-26 13:50 ` Jim Gettys
  1990-07-27 15:29 ` Steve V. Hodsdon
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Davids @ 1990-07-26  5:41 UTC (permalink / 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


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

end of thread, other threads:[~1990-07-27 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1990-07-26  5:41 Compiler Bug Peter Davids
1990-07-26 13:50 ` Jim Gettys
1990-07-27 15:29 ` Steve V. Hodsdon

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