public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
@ 2023-05-12 11:11 fw at gcc dot gnu.org
  2023-05-12 13:26 ` [Bug c/109826] " fw at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-05-12 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109826
           Summary: Incompatible pointer types in ?: not covered by
                    -Wincompatible-pointer-types
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fw at gcc dot gnu.org
  Target Milestone: ---

This:

int *p;
long *q;

char *
f (int x)
{
  return x ? p : q;
}

warns as follows:

warning: pointer type mismatch in conditional expression

So it doesn't fail to compile with -Werror=incompatible-pointer-types, which it
probably should given what the warning is about.

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
@ 2023-05-12 13:26 ` fw at gcc dot gnu.org
  2023-05-12 19:37 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-05-12 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Florian Weimer <fw at gcc dot gnu.org> ---
I guess the main issue here is that the common type void * for both the second
and third operand is implicitly converted to many pointer types, including the
original types of those operands. So while converting to void * is harmless at
first, it may still result in an incompatible-pointer-types for the overall
expression.

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
  2023-05-12 13:26 ` [Bug c/109826] " fw at gcc dot gnu.org
@ 2023-05-12 19:37 ` pinskia at gcc dot gnu.org
  2023-05-13 15:11 ` egallager at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-12 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The warning is not even controlled by an option either so only -Werror turns it
into an error.

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
  2023-05-12 13:26 ` [Bug c/109826] " fw at gcc dot gnu.org
  2023-05-12 19:37 ` pinskia at gcc dot gnu.org
@ 2023-05-13 15:11 ` egallager at gcc dot gnu.org
  2023-05-30 21:13 ` egallager at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-05-13 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> The warning is not even controlled by an option either so only -Werror turns
> it into an error.

Thus, this fits under bug 44209


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-05-13 15:11 ` egallager at gcc dot gnu.org
@ 2023-05-30 21:13 ` egallager at gcc dot gnu.org
  2023-10-20  8:55 ` fw at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-05-30 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-05-30
     Ever confirmed|0                           |1

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(anyways, confirmed)

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-05-30 21:13 ` egallager at gcc dot gnu.org
@ 2023-10-20  8:55 ` fw at gcc dot gnu.org
  2023-10-20 20:16 ` cvs-commit at gcc dot gnu.org
  2023-10-20 20:19 ` fw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-10-20  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|NEW                         |ASSIGNED

--- Comment #5 from Florian Weimer <fw at gcc dot gnu.org> ---
Patch posted:
https://inbox.sourceware.org/gcc-patches/87pm19znaa.fsf@oldenburg.str.redhat.com/

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-10-20  8:55 ` fw at gcc dot gnu.org
@ 2023-10-20 20:16 ` cvs-commit at gcc dot gnu.org
  2023-10-20 20:19 ` fw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-20 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:857a6ee25ff5cbb97715de4dd97e1641285c6085

commit r14-4804-g857a6ee25ff5cbb97715de4dd97e1641285c6085
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Oct 20 21:27:52 2023 +0200

    c: -Wincompatible-pointer-types should cover mismatches in ?:

    gcc/c/

            PR c/109826
            PR other/44209
            * c-typeck.cc (build_conditional_expr): Use
            OPT_Wincompatible_pointer_types for pointer mismatches.
            Emit location information for the operand.

    gcc/testsuite/

            * gcc.dg/Wincompatible-pointer-types-2.c: New.
            * gcc.dg/Wincompatible-pointer-types-3.c: New.
            * gcc.dg/Wincompatible-pointer-types-4.c: New.

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

* [Bug c/109826] Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types
  2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-10-20 20:16 ` cvs-commit at gcc dot gnu.org
@ 2023-10-20 20:19 ` fw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2023-10-20 20:19 UTC (permalink / raw)
  To: gcc-bugs

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

Florian Weimer <fw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Florian Weimer <fw at gcc dot gnu.org> ---
Fixed for GCC 14.

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

end of thread, other threads:[~2023-10-20 20:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 11:11 [Bug c/109826] New: Incompatible pointer types in ?: not covered by -Wincompatible-pointer-types fw at gcc dot gnu.org
2023-05-12 13:26 ` [Bug c/109826] " fw at gcc dot gnu.org
2023-05-12 19:37 ` pinskia at gcc dot gnu.org
2023-05-13 15:11 ` egallager at gcc dot gnu.org
2023-05-30 21:13 ` egallager at gcc dot gnu.org
2023-10-20  8:55 ` fw at gcc dot gnu.org
2023-10-20 20:16 ` cvs-commit at gcc dot gnu.org
2023-10-20 20:19 ` fw 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).