Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade frontend & libs to v2.110 #4707

Merged
merged 108 commits into from
Aug 10, 2024
Merged

Conversation

kinke
Copy link
Member

@kinke kinke commented Jul 16, 2024

No description provided.

WalterBright and others added 30 commits May 9, 2024 23:40
fix issue24534 : goto can skip declarations in labeled statements without error

Signed-off-by: Nicholas Wilson <[email protected]>
Merged-on-behalf-of: Nicholas Wilson <[email protected]>
Part of the effort to extract semantic analysis code from
the AST code.

Co-authored-by: Alex Muscar <[email protected]>
Get rid of obsolete OMF support

Signed-off-by: Nicholas Wilson <[email protected]>
Merged-on-behalf-of: Nicholas Wilson <[email protected]>
Get rid of obsolete `{C,Cpp}Runtime_DigitalMars` special cases

Signed-off-by: Dennis <[email protected]>
Signed-off-by: Nicholas Wilson <[email protected]>
Merged-on-behalf-of: Nicholas Wilson <[email protected]>
The 22 integration tests came with a mix of removing only ROOT
(generated/OS/BUILD/MODEL) or GENERATED (generated) subdirs as
part of their `make clean`.

And running `make clean` in the druntime dir only cleaned up the
default BUILD=release variant, while running `make unittest` without
explicit BUILD type includes running the integration tests in both
debug and release variants.

Streamline/fix this to always cleaning up ROOT, and running `make clean`
in both variants when running druntime's `make clean`.
@kinke
Copy link
Member Author

kinke commented Jul 16, 2024

Great, just one problem for new runnable_cxx/testbitfields.d, possibly the same as #4646.

@kinke kinke marked this pull request as ready for review July 19, 2024 16:58
@kinke
Copy link
Member Author

kinke commented Jul 19, 2024

Interesting, another bit fields problem remaining, on Linux AArch64 only, working with Apple-clang on arm64 though; probably a frontend problem, needing more special cases:

1837: Test 'runnable_cxx/testbitfields.d' failed. The logged output:
1837: /tmp/cirrus-ci-build/../clang/bin/clang++ -c runnable_cxx/extra-files/testbitfields_cpp.cpp -o ../../../build/dmd-testsuite-debug/runnable_cxx/d/testbitfields_cpp.cpp.o -std=c++11
1837: /tmp/build/bin/ldmd2 -conf= -m64 -Irunnable_cxx -g -link-defaultlib-debug -L-lstdc++ -L--no-demangle  -od../../../build/dmd-testsuite-debug/runnable_cxx/d -of../../../build/dmd-testsuite-debug/runnable_cxx/d/testbitfields_0  runnable_cxx/testbitfields.d runnable_cxx/extra-files/testbitfields_importc.c ../../../build/dmd-testsuite-debug/runnable_cxx/d/testbitfields_cpp.cpp.o 
1837: ../../../build/dmd-testsuite-debug/runnable_cxx/d/testbitfields_0  --DRT-testmode=run-main
1837: Struct S16 has different bitfield layout for C and D:
1837:   D: size=4 align=1
1837:   C: size=4 align=4
1837: Struct S18 has different bitfield layout for C and D:
1837:   D: size=9 align=1
1837:   C: size=16 align=8
1837:   char a:
1837:     D: FF000000 00000000 00
1837:     C: FF000000 00000000 00000000 00000000
1837:   char b:
1837:     D: 00000000 00000000 FF
1837:     C: 00000000 00000000 FF000000 00000000

@kinke
Copy link
Member Author

kinke commented Jul 19, 2024

Oh WTF:

struct S16 { int :32; };
struct S18 { char a; long long :0; char b; };

static_assert(alignof(S16) == 1); // 4 on non-Apple AArch64
static_assert(alignof(S18) == 1); // 8 on non-Apple AArch64

It works fine for arm64-apple-macos and riscv64-linux-gnu, x86 etc., but not for aarch64-linux-gnu and aarch64-freebsd. So looks like some AArch64 special case, where anonymous and 0-length bitfields do contribute to the aggregate alignment, and Apple went with a simpler/standard approach. I've checked this with clang v18.1.0, and latest stable AArch64 gcc on godbolt.org.

This appears to be handled in https://github.com/dlang/dmd/blob/6c826179ad5eec50b0bc40411acce8f7053e333f/compiler/src/dmd/dsymbolsem.d#L7176-L7193, possibly requiring a new BitFieldStyle enum member.

@kinke
Copy link
Member Author

kinke commented Jul 20, 2024

Okay, spec is here: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#1018bit-fields

The container type contributes to the alignment of the containing aggregate in the same way a plain (not bit-field) member of that type would, without exception for zero-sized or anonymous bit-fields.

Note

The C++ standard states that an anonymous bit-field is not a member, so it is unclear whether or not an anonymous bit-field of non-zero size should contribute to an aggregate’s alignment. Under this ABI it does.

@tim-dlang
Copy link
Contributor

The layout for Linux armv7 is currently also wrong. Interestingly Apple seems to behave the same as Linux for armv7 and only aarch64 is different:

for t in aarch64-apple-darwin aarch64-unknown-linux-gnu \
  armv7k-apple-watchos armv7s-apple-ios armv7-unknown-linux-gnueabi
do
  echo ============ $t ============
  clang test.c -Xclang -fdump-record-layouts -c --target="$t" \
    | sed -n "/Dumping AST/,/^$/p"
done
============ aarch64-apple-darwin ============
*** Dumping AST Record Layout
         0 | struct S18
         0 |   char a
       8:- |   long long 
         8 |   char b
           | [sizeof=9, align=1]

============ aarch64-unknown-linux-gnu ============
*** Dumping AST Record Layout
         0 | struct S18
         0 |   char a
       8:- |   long long 
         8 |   char b
           | [sizeof=16, align=8]

============ armv7k-apple-watchos ============
*** Dumping AST Record Layout
         0 | struct S18
         0 |   char a
       8:- |   long long 
         8 |   char b
           | [sizeof=16, align=8]

============ armv7s-apple-ios ============
*** Dumping AST Record Layout
         0 | struct S18
         0 |   char a
       4:- |   long long 
         4 |   char b
           | [sizeof=8, align=4]

============ armv7-unknown-linux-gnueabi ============
*** Dumping AST Record Layout
         0 | struct S18
         0 |   char a
       8:- |   long long 
         8 |   char b
           | [sizeof=16, align=8]

dkorpel and others added 6 commits July 22, 2024 11:00
Required for 32-bit ARM, and non-Apple 64-bit ARM targets.

The only difference to `Gcc_Clang` is that anonymous and 0-length
bit-fields do contribute to the aggregate alignment.

Caught by existing proper C interop tests in
runnable_cxx/testbitfields.d on such targets. The hardcoded bad tests
in runnable/{bitfieldsposix64.c,dbitfieldsposix64.d} however now fail
after the fix, on such targets again.
@kinke kinke enabled auto-merge August 10, 2024 17:43
@kinke kinke merged commit 6bd5d9a into ldc-developers:master Aug 10, 2024
20 checks passed
@kinke kinke deleted the merge-2.110 branch August 10, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.