Issue 55503
Summary clang miscompiles the example with __ptr32 attribute
Labels new issue
Assignees
Reporter narekchj
    The executable got by building the example below crashes. Used clang15 (trunk) to compile the example.
Expected result:
11
11

`#include <stdio.h>

struct TEST_STRUCT {
    short       len;
    char        txt;
};

TEST_STRUCT a = {11, '0'};

typedef TEST_STRUCT* __ptr32 TEST_STRUCT_PTR;

void test_call(int c) {
  printf("%d\n", c);
}

int main() {
    test_call(((TEST_STRUCT_PTR)&a)->len);
    test_call(((TEST_STRUCT_PTR)&a)->len);
    return 0;
 }
`

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to