Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 191937 - CFLAGs -O0 is ignored by some packages, for those packages -O2 or -O3 was used; I have reason to believe that by negating -O entirely I found a bug at one point
Summary: CFLAGs -O0 is ignored by some packages, for those packages -O2 or -O3 was use...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
Depends on:
Reported: 2007-09-10 03:24 UTC by Trevor A. Thompson
Modified: 2007-09-10 07:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Trevor A. Thompson 2007-09-10 03:24:16 UTC
I'll try to describe my issues with this in the same order I have described them in the summary:

1. I don't want optimizations, I've had bad experiences with optimizations. Moreover I'm also experienced in C programming however the optimization features used in -O2 -O3 I don't know anything about and I'm going to have to assume that based on what some of them describe, they probably wouldn't make my life much easier for debugging even if I did add USE="debug" emerge <packagename> 

I've spoken to a couple of people regarding this, who claim it is likely that some of these features enabled, may be a requirement or without them execution would be too slow; so what's to say that under a high load I won't still experience an issue with a race condition, not to mention a bad practice in programming if you should need features that are not specific to C in order to provide compiled code that the entire rest of the OS needs to function? 

And furthermore, Ok, so it relies on some optimization features to be enabled in order to compile (presumably) but does it need all of -O2 or -O3? If not then can't it just use the features that it needs? 

2. And so really all I want from this is not a bug fix or a promise to do better because I'm not the kind of person to ask someone to deal in matters that are out of their hands let alone not my place to speculate whether or not it should be "fixed" I just want a feature that I can enable that will cause emerge to stop emerging if it encounters an ebuild that uses anything but the -O0 option specified in the CFLAGS var of my make.conf whether it's a default feature or not. I'd even be willing to write the patch myself however I will only do this under the condition that it's something worthy of being contributed to this project; I don't do so well at keeping up with my own stuff right now and I have better things I could be doing with my time--let me know.

I can't be sure, but starting about a month ago I decided to try gentoo again after 2 years... and then again recently but the first time around I'm almost positive my issue may have been with the fact that I had completely negated the -O option from my cflags and it wasn't entirely obvious.

Thank you


Reproducible: Always

Steps to Reproduce:
1. used -O0 
2. negated -O0
3. didn't write down any of the package names-- mplayer is one in particular I remember from way back that frustrated me because I was having trouble with it and couldn't get it to compile using any optimization level other than what it chose for itself.

Actual Results:  
did the exact opposite of what I needed it to do without any indication whatsoever that it was happening. I just happened to notice it during a build.

Expected Results:  
packages compiled using the "0" optimization level (see: gcc handbook for a description of all optimization levels.)
Comment 1 SpanKY gentoo-dev 2007-09-10 03:42:49 UTC
not a portage bug ... you'll probably have to file individual bugs for each package rather than talking in broad terms as this will need to be fixed for each package

if a package has timing issues that crop up when using -O0 rather than -O2, that package is a pile of crap and has race conditions in its code that need to be fixed, not ignored.  anyone who tells you differently probably has no idea what's going on.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-09-10 05:45:51 UTC
@vapier - feel free to fix the mplayer "pile of crap" e.g.. Until then, maintainers will just kill any bugs about "ignored CFLAGS" and the ebuild will stay as is.

Closing this bug because it can't be assigned.
Comment 3 SpanKY gentoo-dev 2007-09-10 06:21:38 UTC
why dont you read my comment again instead of making up your own

i made no such statement that said "any package forcing optimizations is broken"

packages which do force CFLAGS should have a local USE flag 'custom-cflags' like mplayer already does
Comment 4 Martin Väth 2007-09-10 07:21:24 UTC
Just two technical remarks which are widely unknown:

1. Using no optimization does not necessarily produce the most stable code. In fact, it can produce broken code, see bug 146300 or bug 187946.

2. The -O? flags enable also optimizations which cannot be enabled individually (or at least not individually in exactly the same manner). An example are the -falign-options which can be only used to tune *some* of the processor-specific alignment defaults set by -O2.
Comment 5 SpanKY gentoo-dev 2007-09-10 07:31:04 UTC
both bugs you cite are with an older hardened compiler ... -O0 there is not even close to the same as -O0 on a vanilla compiler