intel / intel/llvm

Delayed Diagnostics broken for some diagnostic types that don't check dependence.

Open
#1,018 10 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

After #998 as noticed in #971, some of the diagnostics are not diagnosing in kernels. See this message here:

`The problem is that in SOME cases, we actually visit a diagnostic up to 3x (in the case of kernels).

1: When doing Phase 1 of templates.

2: when doing Phase 2. This is only supposed to happen when something has 'changed' via tree-transform. GCCAsm seems to skip the rebuild in tree-transform if nothing has changed, but apparently CallExpr does NOT. The result is something that has already diagnosed, diagnoses again.

3: When constructing the OpenCL kernel. We likely shouldn't do ANY diagnostics here, since we should have done it in either 1 or 2 above.

Right now, we intentionally skip 3 (thanks to my last change). We are also (perhaps improperly) skipping 1. Due to a bug (IMO) in Tree-transform for CallExpr , the variadic function call is getting diagnosed in all 3. GCC ASM is only getting diagnosed in 1 and 3.

I believe the fix is to repair the CallExpr bug in TreeTransform if I can, and remove the skip of 1.`

I now am not sure that the CallExpr fix is the right thing to do, or that the CallExpr bug is not intended. I suspect the right fix is to simply suppress the attempt to re-diagnose in step 2 above, but I'm still evaluating. Normal diagnostics do this by marking the template invalid when it diagnoses an error. Unfortunately, we cannot do so, because it would cause a number of other errors.

I checked a handful of warnings, and realized we don't prevent them from happening 2x either:
https://godbolt.org/z/LesWP4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.