Closed J-MR-T closed 5 months ago
Thank you for submitting a Pull Request (PR) to the LLVM Project!
This PR will be automatically labeled and the relevant teams will be notified.
If you wish to, you can add reviewers by using the "Reviewers" section on this page.
If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @
followed by their GitHub username.
If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.
If you have further questions, they may be answered by the LLVM GitHub User Guide.
You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.
Please be sure to add a release note to clang/docs/ReleaseNotes.rst so users know about the fix.
Oh, sorry, I didn't find anything know how release notes were handled - will do!
A question on that, would you classify this as a breaking change? Technically, it could break the compilation of programs previously compiled with Clang 17 that compile VLA type compound literals, but never execute the code that they're used in; is that enough for it to be listed as a breaking change? If so, would this go under the C/C++ Language Potentially Breaking Changes
header? Or should I create a new C Language Potentially Breaking Changes
header, as this does not affect Clang's C++ behavior itself in any way?
PS: I hope multiple commits in this PR are fine, they are squashed in the end anyway, right?
Btw, you can probably move this PR out of Draft status, it seems awfully close to finished
I'll finish implementing your suggestions, run the tests again locally and then move it out of draft, if that's alright with you :).
A question on that, would you classify this as a breaking change?
This is just a bug fix, so no. Rejecting code that we would erroneously accept (and miscompile in the process) is not really a breaking change.
Btw, you can probably move this PR out of Draft status, it seems awfully close to finished
I'll finish implementing your suggestions, run the tests again locally and then move it out of draft, if that's alright with you :).
Either way is fine I’d say, but the thing is that I personally at least would use draft prs mainly for something where I’m nowhere close to done and it’s not really ready for review because things are probably going to change, but I just want to signal that I’m working on it. If it’s something that’s mostly done or which is at least mostly review-ready, then I’d just use a regular pr, but that’s just how I do it.
Please be sure to add a release note to clang/docs/ReleaseNotes.rst so users know about the fix.
Oh, sorry, I didn't find anything know how release notes were handled - will do!
No worries!
A question on that, would you classify this as a breaking change? Technically, it could break the compilation of programs previously compiled with Clang 17 that compile VLA type compound literals, but never execute the code that they're used in; is that enough for it to be listed as a breaking change? If so, would this go under the
C/C++ Language Potentially Breaking Changes
header? Or should I create a newC Language Potentially Breaking Changes
header, as this does not affect Clang's C++ behavior itself in any way?
Nope -- potentially breaking changes are ones that are likely to be significantly disruptive, but I suspect very few folks will have code suddenly rejected as a result of your fix.
PS: I hope multiple commits in this PR are fine, they are squashed in the end anyway, right?
Totally fine!
Btw, you can probably move this PR out of Draft status, it seems awfully close to finished
I'll finish implementing your suggestions, run the tests again locally and then move it out of draft, if that's alright with you :).
Either way is fine I’d say, but the thing is that I personally at least would use draft prs mainly for something where I’m nowhere close to done and it’s not really ready for review because things are probably going to change, but I just want to signal that I’m working on it. If it’s something that’s mostly done or which is at least mostly review-ready, then I’d just use a regular pr, but that’s just how I do it.
FWIW, that's what I'm used to as well. I usually ignore anything marked "Draft" on the assumption it's not ready for review, but I happened to remember the discussion on the issue and peeked at this one anyway. :-)
@llvm/pr-subscribers-clang
Author: Jim M. R. Teichgräber (J-MR-T)
Merging this for you since you don’t appear to have commit perms.
@J-MR-T Congratulations on having your first Pull Request (PR) merged into the LLVM Project!
Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.
Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.
How to do this, and the rest of the post-merge process, is covered in detail here.
If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.
If you don't get any reports, no action is required from you. Your changes are working as expected, well done!
C99-C23 6.5.2.5 says: The type name shall specify an object type or an array of unknown size, but not a variable length array type.
Closes issue #89835 .
I
git clang-format
'ed my changes and ran the clang tests, which passed after minor adjustments to the new behavior.I mostly implemented everything as discussed in #89835, with the exception of clang/test/C/C2x/n2900_n3011_2.c: in that file I deleted the part about VLA compound literals, because the file relies on LLVM-IR being emitted by clang, and checking for diagnostics here wouldn't have fit with the rest of the file. Adding another RUN line and handling this case independently in that file would be an option, but it felt out of place. Of course, I'm still open to doing it that way, or preserving the test another way, if that is preferred.
As I point out here, the new behavior leads to a confusing reality brought about by the C23 standard:
is valid code, while
is not. As this seems to be what the standard requests, I implemented it that way for now.
Tagging @Sirraide and @AaronBallman as requested :).