public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109836] New: -Wpointer-sign must be enabled by default
@ 2023-05-12 18:13 fw at gcc dot gnu.org
  2023-05-12 18:18 ` [Bug c/109836] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fw at gcc dot gnu.org @ 2023-05-12 18:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

            Bug ID: 109836
           Summary: -Wpointer-sign must be enabled by default
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fw at gcc dot gnu.org
  Target Milestone: ---

Assignment between incompatible pointers is a constraint violation and has to
be diagnosed in some way. If GCC does not want to error on it (perhaps
understandable), it still needs to warn.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign must be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
@ 2023-05-12 18:18 ` pinskia at gcc dot gnu.org
  2023-05-12 18:22 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-12 18:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is enabled for -pedantic ...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign must be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
  2023-05-12 18:18 ` [Bug c/109836] " pinskia at gcc dot gnu.org
@ 2023-05-12 18:22 ` pinskia at gcc dot gnu.org
  2023-05-12 18:27 ` [Bug c/109836] -Wpointer-sign should " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-12 18:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I had thought this was documented as an extension too. But I can't find that
part of the documentation.

But the option is definitely documented as being enabled with -Wpedantic:
https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Warning-Options.html#index-Wpointer-sign

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign should be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
  2023-05-12 18:18 ` [Bug c/109836] " pinskia at gcc dot gnu.org
  2023-05-12 18:22 ` pinskia at gcc dot gnu.org
@ 2023-05-12 18:27 ` jakub at gcc dot gnu.org
  2023-05-13 15:08 ` egallager at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-12 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is already enabled by -Wall and -pedantic and error with -pedantic-errors,
I'm not sure we want to warn by default here.
At least, we'd need details on how many extra warnings does that result on
real-world code.  I think it doesn't create too much harm not to warn by
default, especially because it is fine for aliasing.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign should be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-05-12 18:27 ` [Bug c/109836] -Wpointer-sign should " jakub at gcc dot gnu.org
@ 2023-05-13 15:08 ` egallager at gcc dot gnu.org
  2023-05-30 21:44 ` egallager at gcc dot gnu.org
  2023-08-09  0:18 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-05-13 15:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
How about:

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0d0ad0a6374..f046d91d03b 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1178,7 +1178,7 @@ C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning
LangEnabledBy(C ObjC C++ ObjC+
 Warn about function pointer arithmetic.

 Wpointer-sign
-C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic)
+C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic
|| Wextra)
 Warn when a pointer differs in signedness in an assignment.

 Wpointer-compare

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign should be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-05-13 15:08 ` egallager at gcc dot gnu.org
@ 2023-05-30 21:44 ` egallager at gcc dot gnu.org
  2023-08-09  0:18 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-05-30 21:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #4)
> How about:
> 
> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> index 0d0ad0a6374..f046d91d03b 100644
> --- a/gcc/c-family/c.opt
> +++ b/gcc/c-family/c.opt
> @@ -1178,7 +1178,7 @@ C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning
> LangEnabledBy(C ObjC C++ ObjC+
>  Warn about function pointer arithmetic.
>  
>  Wpointer-sign
> -C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall ||
> Wpedantic)
> +C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall ||
> Wpedantic || Wextra)
>  Warn when a pointer differs in signedness in an assignment.
>  
>  Wpointer-compare

I sent this to the gcc-patches mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2023-May/620137.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109836] -Wpointer-sign should be enabled by default
  2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-05-30 21:44 ` egallager at gcc dot gnu.org
@ 2023-08-09  0:18 ` egallager at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-08-09  0:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109836

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-August/
                   |                            |626732.html

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #5)
> (In reply to Eric Gallager from comment #4)
> > How about:
> > 
> > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> > index 0d0ad0a6374..f046d91d03b 100644
> > --- a/gcc/c-family/c.opt
> > +++ b/gcc/c-family/c.opt
> > @@ -1178,7 +1178,7 @@ C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning
> > LangEnabledBy(C ObjC C++ ObjC+
> >  Warn about function pointer arithmetic.
> >  
> >  Wpointer-sign
> > -C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall ||
> > Wpedantic)
> > +C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall ||
> > Wpedantic || Wextra)
> >  Warn when a pointer differs in signedness in an assignment.
> >  
> >  Wpointer-compare
> 
> I sent this to the gcc-patches mailing list:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-May/620137.html

Updated version:
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626732.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-09  0:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 18:13 [Bug c/109836] New: -Wpointer-sign must be enabled by default fw at gcc dot gnu.org
2023-05-12 18:18 ` [Bug c/109836] " pinskia at gcc dot gnu.org
2023-05-12 18:22 ` pinskia at gcc dot gnu.org
2023-05-12 18:27 ` [Bug c/109836] -Wpointer-sign should " jakub at gcc dot gnu.org
2023-05-13 15:08 ` egallager at gcc dot gnu.org
2023-05-30 21:44 ` egallager at gcc dot gnu.org
2023-08-09  0:18 ` egallager 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).