public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98397] New: C2X: pointers to arrays with qualifiers are now pointers to qualified types
@ 2020-12-19 23:03 muecker at gwdg dot de
  2020-12-21 22:23 ` [Bug c/98397] " muecker at gwdg dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: muecker at gwdg dot de @ 2020-12-19 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98397
           Summary: C2X: pointers to arrays with qualifiers are now
                    pointers to qualified types
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

C2X mostly adopted the rules already implemented in GCC as an extension.

Still, there are two issues:

1. Some pedantic warning should not appear anymore in C2X.

2. The qualifier of a void pointer returned by the tertiary
operator changes in C2X when the one of the pointers points
to an array with qualified type. (This is then also consistent
with C++ and clang)


The following code should compile:


void foo(void)
{
        const int (*u)[1];
        void *v;
        extern const void *vc;
        extern typeof(1 ? u : v) vc;
        extern typeof(1 ? v : u) vc;
}


I have a patch for this in preparation.

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

* [Bug c/98397] C2X: pointers to arrays with qualifiers are now pointers to qualified types
  2020-12-19 23:03 [Bug c/98397] New: C2X: pointers to arrays with qualifiers are now pointers to qualified types muecker at gwdg dot de
@ 2020-12-21 22:23 ` muecker at gwdg dot de
  2021-08-22 22:15 ` cvs-commit at gcc dot gnu.org
  2021-08-22 22:18 ` muecker at gwdg dot de
  2 siblings, 0 replies; 4+ messages in thread
From: muecker at gwdg dot de @ 2020-12-21 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Uecker <muecker at gwdg dot de> ---


PATCH: https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562359.html

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

* [Bug c/98397] C2X: pointers to arrays with qualifiers are now pointers to qualified types
  2020-12-19 23:03 [Bug c/98397] New: C2X: pointers to arrays with qualifiers are now pointers to qualified types muecker at gwdg dot de
  2020-12-21 22:23 ` [Bug c/98397] " muecker at gwdg dot de
@ 2021-08-22 22:15 ` cvs-commit at gcc dot gnu.org
  2021-08-22 22:18 ` muecker at gwdg dot de
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-22 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:

https://gcc.gnu.org/g:972eab51f53d1db26864ec7d62d40c2ff83407ec

commit r12-3060-g972eab51f53d1db26864ec7d62d40c2ff83407ec
Author: Martin Uecker <muecker@gwdg.de>
Date:   Sun Aug 22 23:47:58 2021 +0200

    Correct treatment of qualifiers for pointers to arrays for C2X [PR98397]

    2021-08-22  Martin Uecker  <muecker@gwdg.de>

    gcc/c/
            PR c/98397
            * c-typeck.c (comp_target_types): Change pedwarn to pedwarn_c11
            for pointers to arrays with qualifiers.
            (build_conditional_expr): For C23 don't lose qualifiers for
pointers
            to arrays when the other pointer is a void pointer. Update
warnings.
            (convert_for_assignment): Update warnings for C2X when converting
from
            void* with qualifiers to a pointer to array with the same
qualifiers.

    gcc/testsuite/
            PR c/98397
            * gcc.dg/c11-qual-1.c: New test.
            * gcc.dg/c2x-qual-1.c: New test.
            * gcc.dg/c2x-qual-2.c: New test.
            * gcc.dg/c2x-qual-3.c: New test.
            * gcc.dg/c2x-qual-4.c: New test.
            * gcc.dg/c2x-qual-5.c: New test.
            * gcc.dg/c2x-qual-6.c: New test.
            * gcc.dg/c2x-qual-7.c: New test.
            * gcc.dg/pointer-array-quals-1.c: Remove unnecessary flag.
            * gcc.dg/pointer-array-quals-2.c: Remove unnecessary flag.

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

* [Bug c/98397] C2X: pointers to arrays with qualifiers are now pointers to qualified types
  2020-12-19 23:03 [Bug c/98397] New: C2X: pointers to arrays with qualifiers are now pointers to qualified types muecker at gwdg dot de
  2020-12-21 22:23 ` [Bug c/98397] " muecker at gwdg dot de
  2021-08-22 22:15 ` cvs-commit at gcc dot gnu.org
@ 2021-08-22 22:18 ` muecker at gwdg dot de
  2 siblings, 0 replies; 4+ messages in thread
From: muecker at gwdg dot de @ 2021-08-22 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Uecker <muecker at gwdg dot de> changed:

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

--- Comment #3 from Martin Uecker <muecker at gwdg dot de> ---
Fixed on master.

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

end of thread, other threads:[~2021-08-22 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19 23:03 [Bug c/98397] New: C2X: pointers to arrays with qualifiers are now pointers to qualified types muecker at gwdg dot de
2020-12-21 22:23 ` [Bug c/98397] " muecker at gwdg dot de
2021-08-22 22:15 ` cvs-commit at gcc dot gnu.org
2021-08-22 22:18 ` muecker at gwdg dot de

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).