public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice
@ 2023-03-17 16:39 acoplan at gcc dot gnu.org
  2023-03-18 18:30 ` [Bug c++/109177] " acoplan at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-03-17 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109177
           Summary: Call to C++ function marked unavailable gets diagnosed
                    twice
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

Reproducer:

$ cat t.cc
void f() __attribute__((unavailable));
void g() { f(); }
$ gcc/xgcc -B gcc -c t.cc
t.cc: In function ‘void g()’:
t.cc:2:13: error: ‘void f()’ is unavailable
    2 | void g() { f(); }
      |            ~^~
t.cc:1:6: note: declared here
    1 | void f() __attribute__((unavailable));
      |      ^
t.cc:2:13: error: ‘void f()’ is unavailable
    2 | void g() { f(); }
      |            ~^~
t.cc:1:6: note: declared here
    1 | void f() __attribute__((unavailable));
      |      ^

This only seems to happen in C++ mode, C diagnoses this once as expected.

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
@ 2023-03-18 18:30 ` acoplan at gcc dot gnu.org
  2023-03-20 11:08 ` acoplan at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-03-18 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-18
           Assignee|unassigned at gcc dot gnu.org      |acoplan at gcc dot gnu.org

--- Comment #1 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Testing a patch.

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
  2023-03-18 18:30 ` [Bug c++/109177] " acoplan at gcc dot gnu.org
@ 2023-03-20 11:08 ` acoplan at gcc dot gnu.org
  2023-03-21 16:07 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-03-20 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Part of the problem here seems to be that dg-error doesn't care how many times
the same diagnostic is emitted, so it doesn't seem able to detect this failure
mode. Otherwise, I expect this would have shown up in failures of the existing
g++.dg/ext/attr-unavailable*.C tests.

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
  2023-03-18 18:30 ` [Bug c++/109177] " acoplan at gcc dot gnu.org
  2023-03-20 11:08 ` acoplan at gcc dot gnu.org
@ 2023-03-21 16:07 ` ppalka at gcc dot gnu.org
  2023-03-21 16:29 ` acoplan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-21 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW one way to test against duplicate errors currently is something like:

void f() __attribute__((unavailable)); // { dg-bogus "is unavailable.*is
unavailable" }
// { dg-error "is unavailable" "" { target *-*-* } .-1 }

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-03-21 16:07 ` ppalka at gcc dot gnu.org
@ 2023-03-21 16:29 ` acoplan at gcc dot gnu.org
  2023-03-22 15:21 ` cvs-commit at gcc dot gnu.org
  2023-03-22 15:41 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-03-21 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alex Coplan <acoplan at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #3)
> FWIW one way to test against duplicate errors currently is something like:
> 
> void f() __attribute__((unavailable)); // { dg-bogus "is unavailable.*is
> unavailable" }
> // { dg-error "is unavailable" "" { target *-*-* } .-1 }

Thanks, that's helpful. I suppose it would be nice if DejaGnu could be modified
(or perhaps configured) so that errors are only matched at most once, but that
seems unlikely to happen and it would be awkward to coordinate across projects.

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-03-21 16:29 ` acoplan at gcc dot gnu.org
@ 2023-03-22 15:21 ` cvs-commit at gcc dot gnu.org
  2023-03-22 15:41 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-22 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alex Coplan <acoplan@gcc.gnu.org>:

https://gcc.gnu.org/g:d3a6f174543816600b1f472997d492088e4e396a

commit r13-6801-gd3a6f174543816600b1f472997d492088e4e396a
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Wed Mar 22 15:20:49 2023 +0000

    c++: Avoid duplicate diagnostic calling unavailable function [PR109177]

    As the PR shows, we currently emit duplicate diagnostics for calls to
    functions marked with __attribute__((unavailable)). This patch fixes
    that.

    gcc/cp/ChangeLog:

            PR c++/109177
            * call.cc (build_over_call): Use make_temp_override to suppress
            both unavailable and deprecated warnings when calling
            build_addr_func.

    gcc/testsuite/ChangeLog:

            PR c++/109177
            * g++.dg/ext/pr109177.C: New test.

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

* [Bug c++/109177] Call to C++ function marked unavailable gets diagnosed twice
  2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-03-22 15:21 ` cvs-commit at gcc dot gnu.org
@ 2023-03-22 15:41 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-03-22 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

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

--- Comment #6 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Fixed for GCC 13. Since this doesn't seem to be a regression (and it's quite a
minor issue) I guess it's not worth backporting.

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

end of thread, other threads:[~2023-03-22 15:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 16:39 [Bug c++/109177] New: Call to C++ function marked unavailable gets diagnosed twice acoplan at gcc dot gnu.org
2023-03-18 18:30 ` [Bug c++/109177] " acoplan at gcc dot gnu.org
2023-03-20 11:08 ` acoplan at gcc dot gnu.org
2023-03-21 16:07 ` ppalka at gcc dot gnu.org
2023-03-21 16:29 ` acoplan at gcc dot gnu.org
2023-03-22 15:21 ` cvs-commit at gcc dot gnu.org
2023-03-22 15:41 ` acoplan 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).