Skip to content

Flaky embedded mode test "test/embedded/traps-fatalerror-ir.swift" #81085

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

Closed
glessard opened this issue Apr 25, 2025 · 2 comments · Fixed by #81154
Closed

Flaky embedded mode test "test/embedded/traps-fatalerror-ir.swift" #81085

glessard opened this issue Apr 25, 2025 · 2 comments · Fixed by #81154
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. embedded Embedded Swift

Comments

@glessard
Copy link
Contributor

Description

After making some unrelated changes (#80792), “test/embedded/traps-fatalerror-ir.swift” fails in its fifth variant, where swiftc is invoked with “-Osize -assert-config Debug”

The CHECK-MESSAGE at line 38 now no longer matches, because the symbol it should match becomes $eSS8withUTF8yxxSRys5UInt8VGKXEKlFyt_Tg5088$es17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtFySRys5C7VGXEfU_s0jK0VAGSuTf1ncn_n which doesn’t match ${{es17_assertionFailure__}}.

I include that version of the IR, the output of

$ xcrun bin/swiftc -emit-ir -Osize -assert-config Debug -wmo -enable-experimental-feature Embedded ../../../swift/test/embedded/traps-fatalerror-ir.swift

This is with the branch from the PR above, with the rest of the repos at swift-DEVELOPMENT-SNAPSHOT-2025-04-12-a except swift-syntax, which was advanced to commit fb65fcb05c15498d8dbbc14123c5fb7e0136a0af.

This is the run line that fails:

// RUN: %target-swift-emit-ir -enable-experimental-feature Embedded -wmo %s -Osize -assert-config Debug | %FileCheck %s --check-prefix=CHECK-MESSAGE

Reproduction

From a swift checkout:

$ utils/update-checkout --tag swift-DEVELOPMENT-SNAPSHOT-2025-04-12-a
$ pushd ../swift-syntax
$ git checkout fb65fcb05c15498d8dbbc14123c5fb7e0136a0af
$ popd
$ git remote add -t rdar149987432-reproducer other https://github.com/glessard/swift
$ git fetch other
$ git checkout f4c4657c05d6bcfea9f320c3fe151eb4957fd712
$ utils/build-script --release --test=true

The embedded test "test/embedded/traps-fatalerror-ir.swift" will fail thusly:

test/embedded/traps-fatalerror-ir.swift:39:24: error: CHECK-MESSAGE-SAME: is not on the same line as the previous match
// CHECK-MESSAGE-SAME: Fatal error
                       ^
<stdin>:640:143: note: 'next' match was here
 tail call swiftcc void @"$es31_embeddedReportFatalErrorInFile6prefix7message4file4lineys12StaticStringV_A2GSutF"(i64 ptrtoint (ptr @".str.11.Fatal error" to i64), i64 11, i8 2, i64 ptrtoint (ptr @.str.0. to i64), i64 0, i8 2, i64 ptrtoint (ptr @".str.23.Swift/SmallString.swift" to i64), i64 23, i8 2, i64 144)
                                                                                                                                              ^
<stdin>:558:119: note: previous match ended here
 call swiftcc void @"$es31_embeddedReportFatalErrorInFile6prefix7message4file4lineys12StaticStringV_SRys5UInt8VGAGSutF"(i64 %2, i64 poison, i8 %4, i64 %33, i64 %32, i64 %5, i64 poison, i8 %7, i64 %8)
                                                                                                                      ^

Input file: <stdin>
Check file: /Volumes/Codage/swift-public/swift/test/embedded/traps-fatalerror-ir.swift

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
       635:  %7 = icmp ne i64 %6, 0 
       636:  %8 = xor i1 %4, %7 
       637:  br i1 %8, label %10, label %9, !prof !8 
       638:  
       639: 9: ; preds = %entry 
       640:  tail call swiftcc void @"$es31_embeddedReportFatalErrorInFile6prefix7message4file4lineys12StaticStringV_A2GSutF"(i64 ptrtoint (ptr @".str.11.Fatal error" to i64), i64 11, i8 2, i64 ptrtoint (ptr @.str.0. to i64), i64 0, i8 2, i64 ptrtoint (ptr @".str.23.Swift/SmallString.swift" to i64), i64 23, i8 2, i64 144) 
same:39                                                                                                                                                   !~~~~~~~~~~                                                                                                                                                                error: match on wrong line
       641:  tail call void asm sideeffect "", "n"(i32 0) #14 
       642:  tail call void @llvm.trap() 
       643:  unreachable 
       644:  
       645: 10: ; preds = %entry 
         .
         .
         .
>>>>>>

Attaching the IR emitted by my built toolchain in the configuration that fails.

traps-fatalerror-ir.emitted-ir.txt

Expected behavior

The test should succeed.

Environment

swift-DEVELOPMENT-SNAPSHOT-2025-04-12-a, with adjustments (see above)

Additional information

Also reported as rdar://149987432

@glessard glessard added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. embedded Embedded Swift labels Apr 25, 2025
glessard added a commit to glessard/swift that referenced this issue Apr 25, 2025
@kubamracek kubamracek self-assigned this Apr 25, 2025
@glessard
Copy link
Contributor Author

Here's a much simpler way to make this test fail: #81116

@kubamracek
Copy link
Contributor

Here's a much simpler way to make this test fail: #81116

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. embedded Embedded Swift
Projects
None yet
2 participants