mktime bug back with gcc 4.3.2

Bug #323528 reported by stecklum
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.3 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: autoconf

running configure on the archfs-0.5.4 tree showed that autoconf hangs for quite a while when checking for mktime. The result is

checking for working mktime... no

This happens on a 64bit fully updated 8.10 system, i.e. with the autoconf 2.61-7ubuntu1 package and gcc (Ubuntu 4.3.2-1ubuntu12). Updating autoconf with the Debian 2.63-2 package does not solve the problem.

Revision history for this message
Matthias Klose (doko) wrote :

please attach the source and header files used by the autoconf test

Changed in gcc-4.3:
status: New → Incomplete
Revision history for this message
Andrew Ferguson (adferguson) wrote :

I can confirm this on 32bit fully updated 8.10 as well.

After some more testing, I can confirm this is a gcc bug because it is the -O2 flag which causes the problem. Without that, it is fine.

I have attached the source code to the test to this bug report. Compile like so:

$ gcc -o bar1 -O2 bar.c
$ gcc -o bar2 bar.c
$ ./bar1 [hangs]
$ ./bar2 [no hang]

(-O1 also has no problems)

Changed in gcc-4.3 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Andrew Ferguson (adferguson) wrote :

Really, all that's needed is this part, which basically occurs on line 222 of the above bar.c:

void main() {
        int i = 0;

        for (i = 1; 0 < i; i *= 2) {
                if (0)
                        return;
        }

        return;
}

As you can see, the loop is designed to end when i wraps around and goes negative. With -O2, this doesn't happen for some reason.

Revision history for this message
Andrew Ferguson (adferguson) wrote :

For the record, re-running autoconf on the given project's files (archfs), updated the configure script so that it no longer writes the test in this way. The test then passes appropriately with Ubuntu 8.10.

I'll file a bug against the archfs project to update their configure script.

Revision history for this message
Matthias Klose (doko) wrote :

bug in the testcase. see gcc(1) -fwrapv how to work around this.

Changed in gcc-4.3 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.