Alan Modra <amo...@gmail.com> wrote:
On Wed, May 05, 2021 at 08:05:29AM +0100, Iain Sandoe wrote:
Alan Modra via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 97d6f3863cb..cc3b1b6d666 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -73,8 +73,8 @@ struct stringop_algs
{
const enum stringop_alg unknown_size;
const struct stringop_strategy {
- const int max;
- const enum stringop_alg alg;
+ int max;
+ enum stringop_alg alg;
int noalign;
} size [MAX_STRINGOP_ALGS];
};
does this relate to / fix PR 100246 (which seems to fire for some GCC
versions as well
as older clang)?
Yes, looks like the same issue. I started making a similar fix to the
one you attached to the PR, then laziness kicked in after noticing the
errors were only given on the const elements.
I added a third variant to the PR (as below), which preserves the const-ness
but provides a CTOR. TBH, I have no especial preference for the solution,
but it would be nice to commit one of them :-)
cheers
Iain
The condition is because this header gets pulled in by gcov stuff which is
built
with a C compiler.
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 97d6f38..a417c93 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -73,6 +73,11 @@ struct stringop_algs
{
const enum stringop_alg unknown_size;
const struct stringop_strategy {
+#ifdef __cplusplus
+ stringop_strategy(int _max = -1, enum stringop_alg _alg = libcall,
+ int _noalign = false)
+ : max (_max), alg (_alg), noalign (_noalign) {}
+#endif
const int max;
const enum stringop_alg alg;
int noalign;