public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load
@ 2023-12-17 10:23 sjames at gcc dot gnu.org
2023-12-17 10:36 ` [Bug c/113050] " fw at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-17 10:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
Bug ID: 113050
Summary: -Wincompatible-pointer-types emitted as a warning, not
an error, for __atomic_load
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
CC: arsen at gcc dot gnu.org, fw at gcc dot gnu.org
Target Milestone: ---
Noticed this when building udisks. I suspect this is actually a dupe of
PR69404, but I felt it was worth filing separately given it's interesting to
have it warn-but-not-error.
The expectation was that this would error (b/c of new 14 default), not just
warn:
```
$ gcc -c udisksenumtypes.i
udisksenumtypes.i: In function ‘udisks_get_type’:
udisksenumtypes.i:5:3: warning: argument 2 of ‘__atomic_load’ discards
‘volatile’ qualifier [-Wincompatible-pointer-types]
5 | __atomic_load(in, &out, 5);
| ^~~~~~~~~~~~~
```
It does the right thing with explicit -Werror=:
```
$ gcc -c udisksenumtypes.i -Werror=incompatible-pointer-types
udisksenumtypes.i: In function ‘udisks_get_type’:
udisksenumtypes.i:5:3: error: argument 2 of ‘__atomic_load’ discards ‘volatile’
qualifier [-Werror=incompatible-pointer-types]
5 | __atomic_load(in, &out, 5);
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
```
udisksenumtypes.i:
```
volatile long out;
volatile long* in;
void udisks_get_type() {
__atomic_load(in, &out, 5);
}
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
@ 2023-12-17 10:36 ` fw at gcc dot gnu.org
2023-12-17 10:38 ` sjames at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-17 10:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
--- Comment #1 from Florian Weimer <fw at gcc dot gnu.org> ---
The warning should be -Wdiscared-qualifiers, which is not an error for C.
What confused me is that the volatile qualifier is already accepted for the
first argument. I believe it's valid for the second argument.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
2023-12-17 10:36 ` [Bug c/113050] " fw at gcc dot gnu.org
@ 2023-12-17 10:38 ` sjames at gcc dot gnu.org
2023-12-17 10:40 ` fw at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-17 10:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Yeah, for every attempt I had to reconstruct it manually, I just got the
expected -Wdiscarded-qualifiers, and then realised it was atomic-specific.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
2023-12-17 10:36 ` [Bug c/113050] " fw at gcc dot gnu.org
2023-12-17 10:38 ` sjames at gcc dot gnu.org
@ 2023-12-17 10:40 ` fw at gcc dot gnu.org
2023-12-17 15:39 ` [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types fw at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-17 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
--- Comment #3 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #1)
> The warning should be -Wdiscared-qualifiers, which is not an error for C.
>
> What confused me is that the volatile qualifier is already accepted for the
> first argument. I believe it's valid for the second argument.
Sorry, I wanted to say: “I believe [the warning is] valid for the second
argument.”
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
` (2 preceding siblings ...)
2023-12-17 10:40 ` fw at gcc dot gnu.org
@ 2023-12-17 15:39 ` fw at gcc dot gnu.org
2023-12-20 16:24 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-17 15:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
Florian Weimer <fw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |fw at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2023-12-17
Status|UNCONFIRMED |ASSIGNED
--- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> ---
Patch submitted:
[PATCH] c-family: Use -Wdiscarded-qualifiers for ignored qualifiers in
__atomic_*
<https://inbox.sourceware.org/gcc-patches/87edfk6dr6.fsf@oldenburg.str.redhat.com/>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
` (3 preceding siblings ...)
2023-12-17 15:39 ` [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types fw at gcc dot gnu.org
@ 2023-12-20 16:24 ` cvs-commit at gcc dot gnu.org
2023-12-20 16:24 ` fw at gcc dot gnu.org
2023-12-21 6:38 ` sjames at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-20 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Florian Weimer <fw@gcc.gnu.org>:
https://gcc.gnu.org/g:a48dd581bf917fcd52fb9eab60943825ed96b6d4
commit r14-6751-ga48dd581bf917fcd52fb9eab60943825ed96b6d4
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Dec 20 17:23:40 2023 +0100
c-family: Use -Wdiscarded-qualifiers for ignored qualifiers in __atomic_*
This matches other compiler diagnostics. No test updates are needed
because c-c++-common/pr95378.c does not match a specific -W option.
Fixes commit d2384b7b24f8557b66f6958a05ea99ff4307e75c ("c-family:
check qualifiers of arguments to __atomic built-ins (PR 95378)").
gcc/c-family/
PR c/113050
* c-common.cc (get_atomic_generic_size): Use
OPT_Wdiscarded_qualifiers instead of
OPT_Wincompatible_pointer_types.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
` (4 preceding siblings ...)
2023-12-20 16:24 ` cvs-commit at gcc dot gnu.org
@ 2023-12-20 16:24 ` fw at gcc dot gnu.org
2023-12-21 6:38 ` sjames at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-20 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
Florian Weimer <fw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Florian Weimer <fw at gcc dot gnu.org> ---
I do not plan to backport this change.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
` (5 preceding siblings ...)
2023-12-20 16:24 ` fw at gcc dot gnu.org
@ 2023-12-21 6:38 ` sjames at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-21 6:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113050
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-12-21 6:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17 10:23 [Bug c/113050] New: -Wincompatible-pointer-types emitted as a warning, not an error, for __atomic_load sjames at gcc dot gnu.org
2023-12-17 10:36 ` [Bug c/113050] " fw at gcc dot gnu.org
2023-12-17 10:38 ` sjames at gcc dot gnu.org
2023-12-17 10:40 ` fw at gcc dot gnu.org
2023-12-17 15:39 ` [Bug c/113050] __atomic_* builtins should use -Wdiscarded-qualifiers instead of -Wincompatible-pointer-types fw at gcc dot gnu.org
2023-12-20 16:24 ` cvs-commit at gcc dot gnu.org
2023-12-20 16:24 ` fw at gcc dot gnu.org
2023-12-21 6:38 ` sjames at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).