🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Charles Hannum Sun, 07 Jan 1996 00:00
Re: Recent serial port lossage
#6284
Author: Charles Hannum
Date: Sun, 07 Jan 1996 00:00
33 lines
1347 bytes
I've tracked this down to what I believe to be a bug in GCC 2.7.2.
Basically, if you have code of the form:

volatile int foo;

...

	foo |= 0x80000000;

...

in many (all?) cases, `gcc -O3' now compiles it as:

	movl _foo,%e??
	orl $0x80000000,%e??
	movl %e??,_foo

rather than the obvious:

	orl $0x80000000,_foo

This probably has something to do with pipeline scheduling on the
Pentium, but it's not clear to me that the new behaviour, regardless
of its relative performance, is *correct* for a `volatile' variable.
In particular, I don't see a way to make sig_atomic_t work correctly.
In general, it makes `volatile' nearly useless.

At any rate, I've worked around the problem in this case, but I
wouldn't be surprised if it causes other random bugs.

If you've been having problems, please update your kernel sources
after tonight's update, and let me know if your problems persist.
Re: Recent serial port lossage
#6283
Author: Torbjorn Granlund
Date: Sun, 07 Jan 1996 00:00
14 lines
938 bytes
This is not a bug in GCC.

You need to refresh your understanding of what `volatile' means.  In
particular, it doesn't mean that statements that both read and write a
memory position are executed with the bus locked.

Also not that x86 processors will *not* perform statements like,

	orl $0x80000000,_foo

with the bus locked between the read and the write.  For that, you need to
prefix the `orl' with a `lock' instruction.

Torbjorn
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads