This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] avoid applying attributes to explicit specializations (PR 83871)


On 02/28/2018 02:51 AM, Jakub Jelinek wrote:
On Mon, Feb 26, 2018 at 09:19:56PM -0700, Martin Sebor wrote:
	PR c++/83871
	PR c++/83503
	* g++.dg/ext/attr-const.C: New test.
	* g++.dg/ext/attr-pure.C: New test.

I've tried to fix these 2 tests with following patch, without
-fdump-tree-optimized all the scan-tree-dump* tests are UNRESOLVED,
and when you use the same function for multiple-subtests all you get
is the same failures reported multiple times, but without knowing which
of them failed.

Unfortunately, even with this patch there are failures:
FAIL: g++.dg/ext/attr-const.C  -std=gnu++11  scan-tree-dump-not optimized "test_func_none_const_failed"
...
so if the test is right, then something is still broken on the C++ FE side.

I'll defer debugging this to you.

Thanks for fixing up the unresolved tests.  I have a script that
checks test results against a baseline for unexpected failures
but it doesn't look for differences in UNRESOLVED so I didn't
see them as problems.  I'll have to remember to enhance it to
do that.

With the unresolved problems fixed, the remaining failures are
due to two problems:

1) A regression in the merging of attributes introduced by my
   patch.  I wondered about why attributes const and pure were
   being handled differently than the others here:
   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg01479.html
   Jason explained that parts of the structure were being copied
   via memcpy.  Since I thought my tests were passing I took that
   to mean that the bits were being copied.  Sigh.

2) A pre-existing bug where the C++ front end doesn't apply
   an attribute to a declaration of a function template previously
   declared without one, as in:

   template <class T> int f ();
   template <class T> int __attribute__ ((const)) f ();

   The root cause might be the same as the one behind bug 84294
   - missing warning for ignored attribute on a function template
   declaration.

Let me fix the first one and see what it would take to handle
the second as well.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]