Skip to content

Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)Β #6426

Closed

Description

@Erfan-Ahmadi

Description
SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)

Steps to reproduce:
Godbolt link: https://godbolt.org/z/5hsxeK5aE

Activity

  1. added
    bug
    needs-triage
    on Mar 18, 2024
  2. added
    incorrect-code
    and removed
    needs-triage
    on Mar 18, 2024
  3. damyanp commented on Mar 18, 2024

    @damyanp
    Member

    We also find that the compiler crashes in the non-spirv case as well, so we should have a look into this before declaring it spir-v specific.

  4. changed the title [-][SPIRV] Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)[/-] [+][SPIR-V] Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)[/+] on Mar 18, 2024
  5. cassiebeckley commented on Mar 18, 2024

    @cassiebeckley
    Contributor

    Minimal reproducible example:

    bool operator==(int lhs, int rhs) {
        return true;
    }
    
    void main() {}
    
  6. llvm-beanz commented on Mar 18, 2024

    @llvm-beanz
    Collaborator

    The fix for this is pretty straightforward:

    diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp
    index 31ff6a45851..704824c3822 100644
    --- a/tools/clang/lib/Sema/SemaHLSL.cpp
    +++ b/tools/clang/lib/Sema/SemaHLSL.cpp
    @@ -15690,7 +15690,7 @@ void TryAddShaderAttrFromTargetProfile(Sema &S, FunctionDecl *FD,
     
       // if this FD isn't the entry point, then we shouldn't add
       // a shader attribute to this decl, so just return
    -  if (EntryPointName != FD->getIdentifier()->getName()) {
    +  if (FD->getIdentifier() && EntryPointName != FD->getIdentifier()->getName()) {
         return;
       }

    We should craft some wider test cases too.

  7. changed the title [-][SPIR-V] Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)[/-] [+]Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)[/+] on Mar 20, 2024
  8. 1 remaining item

  9. moved this from πŸ†• New to πŸ— In progress in HLSL Roadmapon Mar 21, 2024
  10. added a commit that references this issue on Mar 21, 2024
    7581ff4
  11. moved this from For MSFT to Done in HLSL Triageon Mar 21, 2024
  12. moved this from πŸ— In progress to βœ… Done in HLSL Roadmapon Mar 21, 2024
  13. damyanp commented on Mar 21, 2024

    @damyanp
    Member

    Re-opening this to track getting the fix cherry-picked into the next point release.

  14. moved this from βœ… Done to πŸ“‹ Backlog in HLSL Roadmapon Mar 25, 2024
  15. added a commit that references this issue on Mar 26, 2024
    11e1318
  16. moved this from πŸ“‹ Backlog to βœ… Done in HLSL Roadmapon Mar 26, 2024
  17. added a commit that references this issue on Jul 15, 2024
    1b9a796
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugincorrect-code

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions