From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tika.stderr.nl (tika.stderr.nl [94.142.244.14]) by sourceware.org (Postfix) with ESMTPS id 74F863857036 for ; Mon, 12 Apr 2021 11:53:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 74F863857036 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=stdin.nl Authentication-Results: sourceware.org; spf=none smtp.mailfrom=matthijs@stdin.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.tikatika.nl; s=201709.tika; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3A179qYFKO229qrypmLZCfzuToMXQ7LM+YcexPnNQoU=; b=bTRDn6CmMficGPKC+JEpXyUNQ feAom0aL9FssycfKXaYVwv2dPSV27HMx0oLgtwqZOjrasQehR+QO0eJ8dzUGM2G5TTUA8AOuiOn6o bg8AfQWy/UprvfIVQcaBJMqP7FmzhULh+dO803vVu8NxJ2YIfdn+k8aw3frq6W4TeHMXM=; X-Preliminary-Spam-Score: -2.9 (--) Received: from [10.42.0.16] (helo=login.tika.stderr.nl) by tika.stderr.nl with smtp (Exim 4.92) (envelope-from ) id 1lVv8M-0004bx-Tx; Mon, 12 Apr 2021 13:53:40 +0200 Received: (nullmailer pid 12348 invoked by uid 2001); Mon, 12 Apr 2021 11:53:38 -0000 Date: Mon, 12 Apr 2021 13:53:38 +0200 From: Matthijs Kooijman To: Klaus Rudolph Cc: "Peter Sommerlad (C++)" , "gcc-help@gcc.gnu.org" , avr-gcc-list@nongnu.org Subject: Re: static class member as interrupt handler works, but not if class is templated Message-ID: <20210412115337.GB250@login.tika.stderr.nl> Mail-Followup-To: Klaus Rudolph , "Peter Sommerlad (C++)" , "gcc-help@gcc.gnu.org" , avr-gcc-list@nongnu.org References: <5f39cb4e-a445-bf19-ae90-b76c934aa930@gmx.de> <38829120-5ab7-d74e-0149-edf8ec6d4227@sommerlad.ch> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UHN/qo2QbUvPLonB" Content-Disposition: inline In-Reply-To: X-PGP-Fingerprint: E7D0 C6A7 5BEE 6D84 D638 F60A 3798 AF15 A156 5658 X-PGP-Key: http://www.stderr.nl/static/files/gpg_pubkey.asc User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_MXURI, SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 11:53:45 -0000 --UHN/qo2QbUvPLonB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > - figure out, where the special handling of the __vector_10 seems to > > happen, and why it is not happening in the class template case. This > > might help diagnose if and where to fix it within the compiler. >=20 > That is compiler internals... yes, if it is a compiler bug, it is the > way to have a solution. But in that case, it seems to be a generic > problem for gcc as attributes are not assigned to any templated class > member functions. No idea if this is related to the target ( avr ) or > generic for all platforms. But I never did any change inside the > compiler. Any help is welcome! My suspiciou would be that this is a generic gcc problem, where the "asm" attribute is not honoured for template functions. It probably also makes some sense, since a template is intended to be instantiated multiple times, and each instantiation gets a name that is generated based on (I believe) the template arguments passed, so I suspect that the "generate a name for this template instantiation" code doesn't look at the asm attribute. Also note that *if* it would, then each instantiation would use the same name and multiple instanations would result in duplicate symbols. If you would bring this up as a gcc bug, I wouldn't be surprised that it would be closed as wontfix for this reason. Another workaround that I think hasn't been suggested yet, would be to just define a global `__vector_10` function and from that just call your templated static member. Combined with the `always_inline` attribute, you can ensure that the call is inlined and there is no runtime overhead (with LTO, this probably already happens when there's just a single call to the member). Maybe not as nice and self-contained as the asm attribute, but it does allow multiple instantiations (where the global function defines which instantiation is going to be used for the ISR). Gr. Matthijs --UHN/qo2QbUvPLonB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMyF3AetYrDfGJ9el6ZMxy91tJYwFAmB0NLwACgkQ6ZMxy91t JYy4DxAA0MLNypdQpbz+Uy86BWICE/Y30LtLQO+2OA4sa8m6uOIwVCXSL/Q68DZ0 qrkK3QhrMurhb0bbSPuiAlpgtgkWraithqdUWH9lXWr8InewfjHEa+pYUd6P3DgA oFlFAvvb8R6x7nT2SyfAJ7PSnbyS39AWHLTdUibW2UC8+syajTW0f7zip2c1HgEW pvxvixyHblFxSEdcYMKg5Mq2HPup20jXgsQElf3OvQOTLVoBHVD8A30vOZV5A3v3 Vxl0Q4ifOQ+Xyj7NE8NZridTznJO82yAUfs13p/gyfsSvGfWkC4xbjyKBrD/2D2B r1wyxWYWDj/8UgP2pbWeaTFfNk+tj5bV/QJEUPI1cNIigD8rdT4+dXo9KIANJ4CA 0MuEyytT7R9tOGx6VGFqdh4nmM1tPhbZYWh0dJZj8EF/CzMnwJn2IF+iIfM/0EJs gPdY8H9GddkMg5u7p+qrXcWcc+34mybcQ1dEQrJvi3/mCoYHHKF05AL1VyJc41yX c0CbuXuXBBQtg02d4dYPEbZRvvglsPdMoz3wMZ9ay5E9pEnB4G3Y2+lWBrO8LDU5 1Niu2yWaoxEWZ/TrceH6gYKqu3eDXbMDP8f10vR5X2+tgVd850ExpLcM+4sWFcXF s8EOsudE+vdTleJnEq8eiPTP+ajByf9LYfo/uAm8IsnggDupMkI= =0qJz -----END PGP SIGNATURE----- --UHN/qo2QbUvPLonB--