[Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test

zsojka at seznam dot cz gcc-bugzilla@gcc.gnu.org
Tue Apr 6 15:37:00 GMT 2010


Command line:
gcc -fschedule-insns vararg-1.c && ./a.out

Testcase can be further reduced to:
----------- testcase.c -----------
int foo(int i, ...) {
  return i;
}
int main() {
  return foo(0, 0.0);
}
----------------------------------
I am not sure the testcase is valid, but I can't find any proof it isn't.
"If access to the varying arguments is desired, the called function shall
declare an object (...) having type va_list." is the most related sentence in
the C99 TC3 draft, but it doesn't say what to do when 'access to varying
arguments isn't desired'.

Tested revisions:
r157965 - crash
4.4.3 - crash
4.3.4, 4.2.4, 4.1.2, 3.4.6, 3.3.6 - OK

Output:
$ gcc-4.5.0-alpha20100401 -fschedule-insns testcase.c && ./a.out
Segmentation fault

The problem is unaligned access with movaps:
foo:
        pushq   %rbp    #
        movq    %rsp, %rbp      #,
        pushq   %rbx    #
        subq    $64, %rsp       #,
        movzbl  %al, %eax       #, tmp61
        leaq    -9(%rbp), %rbx  #, tmp62
...
        movaps  %xmm0, -127(%rbx)       #,
access is aligned to 8-byte boundary, not 16-byte

when -fschedule-insns is not used, "leaq -9(%rbp), %rbx" is changed to "leaq
-1(%rbp), %rdx", and the access is aligned correctly


-- 
           Summary: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c
                    execution test
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43668



More information about the Gcc-bugs mailing list