Port-vax archive

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

Segfault compiling with -O2


I have an issue with one of my programs on vax running netbsd 9.99.80
which I don't understand. While I have at least two ways of working
around it, I'd ideally like to understand what is happening.

The program prints information about modules (Protracker, Noisetracker,
Digibooster, Octamed, Fasttracker and so on). It turns out that when
compiled with -O2 on netbsd/vax, it segfaults.

I took out a small set of functions needed for the situation to appear
and removed dependencies on other stuff, and also included a module
directly in the source. An example is at 


Its the variable finetune where I have trouble understanding
what happens. With -O2, the segfault happens when that variable
is printed, the printf() on line 157. Printing anything other
than finetune at its place makes it not segfault. Also changing the 
int finetune on line 88 to
volatile int finetune

makes it work.

While I could make sense of the disassembly without -O2, I can't really
make sense of it with -O2, but then again, I am not fluent in vax assembly.

Does anybody have any ideas? It could be I've done something stupid
that I can't see, but it works on other platforms as well as this
one when not using -O2. Is it that -O2 is not all well on vax, like I
remember from gcc 2.95-something on openbsd?


Eivind Nicolay Evensen

Home | Main Index | Thread Index | Old Index