Skip to content

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

Open
@erichkeane

Description

@erichkeane

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions