www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/24/10:44:27

Date: Mon, 24 Apr 1995 09:16:55 -0400
From: kagel AT quasar DOT bloomberg DOT com
To: bdavidson AT ra DOT isisnet DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: More optimization woes...
Reply-To: kagel AT ts1 DOT bloomberg DOT com

   Errors-To: postmaster AT ts1
   Date: Sat, 22 Apr 1995 04:24:12 -0300 (ADT)
   From: Bill Davidson <bdavidson AT ra DOT isisnet DOT com>
   Mime-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII
   Content-Length: 826

   Hi all:
   This may not be a djgpp problem (if not, tell me so and where to gripe) 
   but here it is:
   I have a program that uses inline (eg _farptr) functions, so I want to 
   compile with optimization (-O or -O2).  However, I am getting some weird 
   code generation, viz:

   int ListProc (WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2) {
   [snip]
       switch (msg) {
	   case CREATE_WINDOW:
	       wnd->ct = DFmalloc(sizeof(CTLWINDOW));
	       wnd->ct->setting = OFF;	// line 53
   [snip]

   Under edebug32, it seems that line 53 is the first line that is executed; 
   the DFmalloc() line is not executed, and so wnd->ct is NULL and so 
   dereferencing it produces an exception.
   HELP!
   How do I get the compiler to order line 52 before line 53 without giving 
   up optimization?
   Thanks in advance.
   Bill Davidson
   bdavidson AT ra DOT isisnet DOT com


Passing the "-fvolatile" flag to gcc will prevent many optimizations of
pointers assignements and pointer references.  Give it a try I have used this
flag on both UNIX gcc and DJGPP gcc when complex pointer apps would not
optimize correctly.

-- 
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

- Raw text -


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