Bug 58065
Summary: | gcc-3.1-0.14 miscompiles kernel 2.4.18-pre1 rtc.o | ||||||
---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Raw Hide | Reporter: | Need Real Name <whitney> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED NOTABUG | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 1.0 | CC: | jik | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | i386 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2002-02-05 21:08:00 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Need Real Name
2002-01-07 17:11:49 UTC
This no longer occurs for me with gcc 3.1-0.20 and kernel 2.4.18-pre7-ac3. So I'm closing this bug, I hope RAWHIDE is the correct resolution to use, please correct me if I'm wrong. Oops, I spoke too soon: gcc-3.1-0.20 and kernel 2.4.18-pre8 still shows the hwclock problem. Since mainline kernel shows the problem and -ac does not, I'm not sure this is a compiler problem, but I thought I'd reopen the bug, since gcc-2.96 is fine on both trees. The funny thing is, drivers/char/rtc.c is the same in mainline and -ac. Please let me know if I can provide any other information that would be helpful, I'm sure I've not provided enough but don't know what else to provide. OK, either I'm very confused today or the success of gcc 3.1-0.20 on kernel 2.4.18-pre7-ac3 is intermittent. I'm now again seeing the hwclock problem on 2.4.18-pre7-ac3, maybe my earlier successes were spurious? Sorry about the noise. Well, I've tried to reproduce this myself but it worked for me. Anyway, looking at the code differences between 2.96-RH and 3.1-0.21 compiled rtc.o, the most visible one is that gcc 3.1 fails to inline a bunch of routines and instead emits them out of line. So, I wonder, does the bug go away if kernel is compiled with gcc 3.1 with -finline-limit=2000 additional option (well, for rtc.c already 1000 inlines all inline marked functions, but 2000 is a safe value for other places too)? OK, I did a bunch more tests, assuming that the only program that touches the hardware clock is /sbin/hwclock. Then I narrowed it down to this: my hardware clock gets corrupted when hwclock writes to it via /dev/rtc when the kernel is compiled with gcc-3.1. This is true whether or not I use -finline-limit=2000 in compiling the kernel. Reading the hwclock via /dev/rtc works OK. If I use hwclock --directisa, everything works OK, in particular I can recover from the corrupted hwclock this way. And, of course, if I use gcc-2.96 to comiple the kernel, everything works OK. The issue of doing a cold boot to see the problem was a red herring--it was just that since the boot scripts don't write to the hwclock until shutdown, I had to boot twice to see the problem in my usual routine. A few details on my setup: an ASUS A7V motherboard with Athlon Thunderbird 1000, kernel 2.4.18-pre8, gcc-3.1-0.20, rtc.o as a module. I'm attaching the ouput of a bunch of hwclock runs that show the problem. Let me know if I can provide any more information, sorry it took me a while to figure out the problem well enough to properly report it to you. Created attachment 44597 [details]
Notice how hwclock --debug --systohc corrupts the hardware clock.
Looking at what RTC_SET_TIME does: unsigned char mon, day, hrs, min, sec, leap_yr; unsigned char save_control, save_freq_select; ... ((sec)=(((sec)/10)<<4) + (sec)%10); ((min)=(((min)/10)<<4) + (min)%10); ((hrs)=(((hrs)/10)<<4) + (hrs)%10); ((day)=(((day)/10)<<4) + (day)%10); ((mon)=(((mon)/10)<<4) + (mon)%10); ((yrs)=(((yrs)/10)<<4) + (yrs)%10); this looks very much like GCC PR c/5304 I've fixed 3 days ago (gcc miscompiled division/modulo by certain constants for types smaller than int, just tried unsigned char x = 30; x / 10 and it was miscompiled in gcc-3.1-0.20). Could you please try ftp://people.redhat.com/jakub/gcc/3.1-0.21/ ? Thanks. Wow, that does the trick, gcc-3.1-0.21 compiles an rtc.o for which 'hwclock --systohc' no longer corrupts the hwclock. Looks like I was one point release too speedy in looking into this again. BTW, with gcc-3.1, is it better to use -finline-limit=2000 when compiling the kernel? Thanks, Wayne Well, for now -finline-limit=2000 for kernel is a good thing to do, this will be solved till gcc 3.1 final comes out definitely though. |