www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/23/03:51:45

Date: Sat, 22 Apr 1995 04:24:12 -0300 (ADT)
From: Bill Davidson <bdavidson AT ra DOT isisnet DOT com>
Subject: More optimization woes...
To: djgpp AT sun DOT soe DOT clarkson DOT edu

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

- Raw text -


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