[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimizations




Hi there!

Has anyone ever stumbled over a situation where comiling an application
with optimizations turned on (as opposed to compiling with debugging info)
makes the app not work anymore? I experienced it yesterday, and it took
some time to find out... Basically it gets stuck in code that works just
fine with debugging turned on. The code is a select() and a read(), i.e.
system calls. Maybe I do something weird, but that part has worked for
ages... I get no warnings when compiling, except for a:

/usr/include/socketbits.h:173: warning: ANSI C++ forbids zero-size array
`__cmsg_data'

This is also something I'd like to get rid of. It's an warning, not
serious, but it comes from _every_ file I compile, and it's much harder to
spot the more serious because of it.

The flags I use for compilation are:

##########################################################################
# Specific definitions for a 'release' and 'debug' compile
##########################################################################
RELEASECFLAGS = -pedantic -O2 -Wall -I$(INCDIR) -D_REENTRANT
RELEASELFLAGS = -D_REENTRANT -L$(LIBDIR)

DEBUGCFLAGS   = -pedantic -ggdb -Wall -I$(INCDIR) -D_REENTRANT
DEBUGLFLAGS   = -D_REENTRANT -L$(LIBDIR)

The only real difference is the '-ggdb' is replaced by a '-O2'. Does
anyone have any good ideas as to what might go wrong here?

	Chakie

---------------------+------------------------------------------------------
 Jan 'Chakie' Ekholm |    CS at Åbo Akademi University, Turku, Finland
    Linux Inside     | I'm the blue screen of death, no-one hears you scream