mstorsjo wrote:

It turns out that this change did break the `Sema/struct-packed-align.c` 
testcase when built in mingw mode (see 
https://github.com/mstorsjo/llvm-mingw/actions/runs/20208875331/job/58011647890);
 this can be observed in any build if the testcase is amended like this:
```diff
diff --git a/clang/test/Sema/struct-packed-align.c 
b/clang/test/Sema/struct-packed-align.c
index d6d0724da49f..c996a58c11e4 100644
--- a/clang/test/Sema/struct-packed-align.c
+++ b/clang/test/Sema/struct-packed-align.c
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify
 // RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-windows-coff -verify
+// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-windows-gnu -verify
 // RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-scei-ps4 -verify
 // RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-sie-ps5 -verify
 
```

With this change, we're getting the following new failures:
```
# | error: 'expected-error' diagnostics seen but not expected:
# |   File /home/martin/code/llvm-project/clang/test/Sema/struct-packed-align.c 
Line 140: 'n1' declared as an array with a negative size
# |   File /home/martin/code/llvm-project/clang/test/Sema/struct-packed-align.c 
Line 141: 'n2' declared as an array with a negative size
# |   File /home/martin/code/llvm-project/clang/test/Sema/struct-packed-align.c 
Line 175: 'o1' declared as an array with a negative size
# | 3 errors generated.
```

Among other, this part of the testcase now behaves differently:
```c
typedef long long  __attribute__((aligned(1))) nt;

struct nS {
  char buf_nr;
  nt start_lba;
};

#if defined(_WIN32) && !defined(__declspec) // _MSC_VER is unavailable in cc1.
// Alignment doesn't affect packing in MS mode.
extern int n1[sizeof(struct nS) == 16 ? 1 : -1];
extern int n2[__alignof(struct nS) == 8 ? 1 : -1];
#else
extern int n1[sizeof(struct nS) == 9 ? 1 : -1];
extern int n2[__alignof(struct nS) == 1 ? 1 : -1];
#endif
```

https://github.com/llvm/llvm-project/pull/71148
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to