public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60095] New: Dubious diagnostics for attempted surrogate call function
@ 2014-02-06 12:20 lucdanton at free dot fr
0 siblings, 0 replies; only message in thread
From: lucdanton at free dot fr @ 2014-02-06 12:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60095
Bug ID: 60095
Summary: Dubious diagnostics for attempted surrogate call
function
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lucdanton at free dot fr
Using ‘gcc version 4.9.0 20140123 (experimental) (GCC)’ with the following
snippet:
//--------
struct foo {
typedef void(*ptr)(int&);
operator ptr() const;
};
int main()
{
foo f;
void* p = 0;
f(p);
}
//--------
$ g++-trunk -std=c++03 main.cpp
main.cpp: In function 'int main()':
main.cpp:10:8: error: no match for call to '(foo) (void*&)'
f(p);
^
main.cpp:1:8: note: candidate is:
struct foo {
^
main.cpp:10:8: note: foo::ptr {aka void (*)(int&)} <conversion>
f(p);
^
main.cpp:10:8: note: candidate expects 2 arguments, 2 provided
Same output for all -std=c++{03,11,1y} modes. If e.g. foo has a call operator
instead, then the appropriate ‘no known conversion for argument 1 from 'void*'
to 'int&'’ is produced.
>From gcc-bugs-return-442823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 06 12:24:23 2014
Return-Path: <gcc-bugs-return-442823-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17219 invoked by alias); 6 Feb 2014 12:24:22 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17190 invoked by uid 48); 6 Feb 2014 12:24:18 -0000
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/60078] acats c761007 fails on ARM
Date: Thu, 06 Feb 2014 12:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bernd.edlinger at hotmail dot de
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60078-4-nALoTCXAc2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60078-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60078-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg00580.txt.bz2
Content-length: 1850
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`078
--- Comment #8 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Eric Botcazou from comment #7)
> > could it be that the Finalize procedure is missing some sort of spin lock?
>
> There are already explicit delays in the test, so very likely not.
I added the line "delay 0.01; -- <= additional delay here"
and the result was the test fails on X86_64.
If I rewrite both Finalize methods to use protected data like this
the test starts to pass again with the delays.
$ cat c761007_0.ads
with Ada.Finalization;
package C761007_0 is
type Internal is new Ada.Finalization.Controlled
with record
Effect : Character;
end record;
procedure Finalize( I: in out Internal );
protected Data is
procedure Add( Effect : Character );
private
Side_Effect : String(1..80); -- way bigger than needed
Side_Effect_Finger : Natural := 0;
end Data;
end C761007_0;
$ cat c761007_0.adb:
with TCTouch;
package body C761007_0 is
procedure Finalize( I : in out Internal ) is
begin
Data.Add(I.Effect);
end Finalize;
protected body Data is
procedure Add( Effect : Character ) is
Previous_Side_Effect : Boolean := False;
begin
-- look to see if this character has been finalized yet
for SEI in 1..Side_Effect_Finger loop
Previous_Side_Effect := Previous_Side_Effect
or Side_Effect(Side_Effect_Finger) = Effect;
end loop;
delay 0.01; -- <= additional delay here
-- if not, then tack it on to the string, and touch the character
if not Previous_Side_Effect then
Side_Effect_Finger := Side_Effect_Finger +1;
Side_Effect(Side_Effect_Finger) := Effect;
TCTouch.Touch(Effect);
end if;
end Add;
end Data;
end C761007_0;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-06 12:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-06 12:20 [Bug c++/60095] New: Dubious diagnostics for attempted surrogate call function lucdanton at free dot fr
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).