Skip to content

Bad code generation with r128175 #9911

@efriedma-quic

Description

@efriedma-quic
Bugzilla Link 9539
Resolution FIXED
Resolved on Oct 09, 2013 15:53
Version unspecified
OS Linux
CC @atrick

Extended Description

Testcase:
#include <stdio.h>
typedef __int128_t x;
__attribute((noinline)) int a(x i, x j, int *p, int z) {
int k = i>j;
int l = (k?11:111)/z;
asm volatile ("" :::"memory", "rcx", "rax", "rdx", "rbx", "rsi", "rdi", "rbp", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
*p = l;
if (k) return 201/z;
return 0;
}
int main() {
int x;
printf("%d\n", a(1, 0, &x, 1));
}

The compiled program built with clang crashes on x86-64 Linux. The issue is that the code generated to spill EFLAGS corrupts values spilled into the red zone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions