Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

SOUND support in DOS | Piotr | HDA (Developers)

posted by Rugxulo(R) Homepage, Usono, 18.12.2011, 18:12

> Oh yes, I idiot should do it at the beginning instead of messing with gcc
> version packages. When I changed -O2 to -Os in MAKEFILE.DJ it works fine.

This means it is doing something extra with -O2 but not -Os. And in fact they are (allegedly) very similar. Normally I would blindly guess something like -fno-strength-reduce or -fno-strict-aliasing (or whatever) would fix it, but I'm not sure here.

Anyways, GCC 4.6.2's online docs says this:


-Os
Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
-Os disables the following optimization flags:

          -falign-functions  -falign-jumps  -falign-loops
          -falign-labels  -freorder-blocks  -freorder-blocks-and-partition
          -fprefetch-loop-arrays  -ftree-vect-loop-version


But it's true, a lot of code sometimes fails with different optimizations or different GCC versions, sadly. A lot is just regressions (as GCC is quite complex and presumably hard to maintain for a billion targets while also being optimizing). Sometimes it really is good to test with "older" (classic) GCCs, but that's not always possible (e.g. C++).

> New gcc is much more aggressive in opt. I also faced the same problem in my
> code and was unable to fix it on source level so I applied selective
> optimization for that problematic function via
> __attribute__((optimize(0))). As my problem function is not time
> critical I don't care it's not optimized but all the rest of code is.
> It would be good if someone will isolate such problem function in judas
> and make it selective-unoptimized this way.

Indeed, sounds good, but even that attribute (IIRC) only works with GCC 4.4.0 on up. But I guess once you isolate the function, you could snip it out into its own .c file and "gcc -O0" that separately. Presumably it's just some silly bug (yeah, it happens).

 

Complete thread:

Back to the forum
Board view  Mix view
15191 Postings in 1365 Threads, 250 registered users, 15 users online (0 registered, 15 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum