Turns out, this is due to the programmer's assumption that fcb->name[8]
and fcb->ext[3] can be accessed contiguously by fcb->name[0..10]. So,
the code is actually "lazy", if not bad. Obviously, this has worked in C
for a long time but no longer can be depended on.
** Changed in: gcc-9 (Ubuntu)
I've discovered that "-Og" does produce working, somewhat-optimized,
code. Still, I need to understand why this code was appearing to the
optimizer as a no-op. I need to make sure that no other code is being
incorrectly optimized. As it stands, this looks to me to be erroneous
optimization by GCC.
Here's the latest code example, eliminating the need for the cpmutl.h
header file
** Attachment added: "stand-alone match_fcb.c example"
https://bugs.launchpad.net/ubuntu/+source/gcc-9/+bug/1909838/+attachment/5448725/+files/match_fcb.c
--
You received this bug notification because you are a
I see that gcc-7 also has the same issue. I'm starting to wonder if this
code is flawed, but I don't see the problem. I would have thought "-O3"
is pretty safe and sane. I could imagine -O5 doing something like this.
--
You received this bug notification because you are a member of Ubuntu
Bugs, w
On a hunch, I added "volatile" to the declarations of the function
parameters:
int match_fcb(volatile struct cpmfcb *mask, volatile struct cpmfcb *fcb)
This caused code to be generated, and it looks viable. It's still
unclear to me why this code was being optimized away.
--
You received this bu
** Package changed: ubuntu => gcc-9 (Ubuntu)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1909838
Title:
gcc -O3 produces invalid code
To manage notifications about this bug go to:
https://bugs.la
Thank you for taking the time to report this bug and helping to make
Ubuntu better. It seems that your bug report is not filed about a
specific source package though, rather it is just filed against Ubuntu
in general. It is important that bug reports be filed about source
packages so that people
** Attachment added: "Additional (header) file needed to compile."
https://bugs.launchpad.net/ubuntu/+bug/1909838/+attachment/5448651/+files/cpmutl.h
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1