public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
@ 2022-10-17 12:59 marxin at gcc dot gnu.org
2022-10-17 12:59 ` [Bug c++/107295] " marxin at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-17 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
Bug ID: 107295
Summary: [13 Regression] Rejected code in libreoffice with -m32
since r13-3290-g98e341130f87984a
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Since the revision, the following code is rejected:
$ g++ skia.ii -m32 -c -std=c++17
skia.ii:7:22: error: ‘(F{((float)0.0l)} + (F){0.0f})’ is not a constant
expression
7 | constexpr F F0 = F() + 0.0f;
$ g++-12 skia.ii -m32 -c -std=c++17
$ g++ skia.ii -c -std=c++17
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
@ 2022-10-17 12:59 ` marxin at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-17 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-10-17
Target Milestone|--- |13.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
2022-10-17 12:59 ` [Bug c++/107295] " marxin at gcc dot gnu.org
@ 2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-17 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That is likely the
"There is one exception, pr68180.C looks like a bug in the patch which is
also present in the C FE (so I'd like to get it resolved incrementally
in both). Reduced testcase:
typedef float __attribute__((vector_size (16))) float32x4_t;
float32x4_t foo(float32x4_t x, float y) { return x + y; }
with -m32 -std=c11 -Wno-psabi or -m32 -std=c++17 -Wno-psabi
it is rejected with:
pr68180.c:2:52: error: conversion of scalar ‘long double’ to vector
‘float32x4_t’ {aka ‘__vector(4) float’} involves truncation
but without excess precision (say just -std=c11 -Wno-psabi or -std=c++17
-Wno-psabi)
it is accepted. Perhaps we should pass down the semantic type to
scalar_to_vector and use the semantic type rather than excess precision type
in the diagnostics."
issue mentioned in the mail/commit log, though I'd have to verify that.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
2022-10-17 12:59 ` [Bug c++/107295] " marxin at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
@ 2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:30 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-17 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Do you have a reproducer?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (2 preceding siblings ...)
2022-10-17 13:19 ` jakub at gcc dot gnu.org
@ 2022-10-17 13:30 ` marxin at gcc dot gnu.org
2022-10-18 7:55 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-17 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Sure, sorry, I forgot to send it:
template <typename T> struct VecHelper {
typedef T __attribute__((vector_size(sizeof(int)))) V;
};
template <int, typename T> using Vec = typename VecHelper<T>::V;
template <typename T> using V = Vec<4, T>;
using F = V<float>;
constexpr F F0 = F() + 0.0f;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (3 preceding siblings ...)
2022-10-17 13:30 ` marxin at gcc dot gnu.org
@ 2022-10-18 7:55 ` rguenth at gcc dot gnu.org
2022-10-18 10:03 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-18 7:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (4 preceding siblings ...)
2022-10-18 7:55 ` rguenth at gcc dot gnu.org
@ 2022-10-18 10:03 ` jakub at gcc dot gnu.org
2022-10-18 10:55 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-18 10:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ah, so that is a different issue then.
And with slightly modified testcase quite old one, which regressed with:
r8-727-g6b6ae9eb9c06b6911573bb9a13cf98b5a7c98b78
template <typename T> struct VecHelper {
typedef T __attribute__((vector_size(sizeof(int)))) V;
};
template <int, typename T> using Vec = typename VecHelper<T>::V;
template <typename T> using V = Vec<4, T>;
using F = V<float>;
constexpr F F0 = F() + (float) 0.0L;
The problem is that the NOP_EXPR around long double REAL_CST has TREE_CONSTANT
flag and so the CONSTRUCTOR around it and thus we just fold the CONSTRUCTOR in:
case CONSTRUCTOR:
if (TREE_CONSTANT (t) && reduced_constant_expression_p (t))
{
/* Don't re-process a constant CONSTRUCTOR, but do fold it to
VECTOR_CST if applicable. */
verify_constructor_flags (t);
if (TREE_CONSTANT (t))
return fold (t);
}
r = cxx_eval_bare_aggregate (ctx, t, lval,
non_constant_p, overflow_p);
break;
but that handles the case where it has REAL_CST elts, but doesn't handle the
case where it has NOP_EXPRs around them.
I wonder if we just shouldn't call cxx_eval_bare_aggregate always for
VECTOR_TYPE.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (5 preceding siblings ...)
2022-10-18 10:03 ` jakub at gcc dot gnu.org
@ 2022-10-18 10:55 ` jakub at gcc dot gnu.org
2022-10-21 16:07 ` cvs-commit at gcc dot gnu.org
2022-10-21 16:09 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-18 10:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 53719
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53719&action=edit
gcc13-pr107295.patch
Untested fix.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (6 preceding siblings ...)
2022-10-18 10:55 ` jakub at gcc dot gnu.org
@ 2022-10-21 16:07 ` cvs-commit at gcc dot gnu.org
2022-10-21 16:09 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-21 16:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:2cc41601d9a948e8d612a21c3b9a44ce0b977747
commit r13-3438-g2cc41601d9a948e8d612a21c3b9a44ce0b977747
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Oct 21 18:04:54 2022 +0200
c++: Don't shortcut TREE_CONSTANT vector type CONSTRUCTORs in
cxx_eval_constant_expression [PR107295]
The excess precision support broke building skia (dependency of firefox)
on ia32 (it has something like the a constexpr variable), but as the other
cases show, it is actually a preexisting problem if one uses casts from
constants with wider floating point types.
The problem is that cxx_eval_constant_expression tries to short-cut
processing of TREE_CONSTANT CONSTRUCTORs if they satisfy
reduced_constant_expression_p - instead of calling cxx_eval_bare_aggregate
on them it just verifies flags and if they are TREE_CONSTANT even after
that, just fold.
Now, on the testcase we have a TREE_CONSTANT CONSTRUCTOR containing
TREE_CONSTANT NOP_EXPR of REAL_CST. And, fold, which isn't recursive,
doesn't optimize that into VECTOR_CST, while later on we are only able
to optimize VECTOR_CST arithmetics, not arithmetics with vector
CONSTRUCTORs.
The following patch fixes that by rejecting CONSTRUCTORs with vector type
in reduced_constant_expression_p regardless of whether they have
CONSTRUCTOR_NO_CLEARING set or not, folding result in
cxx_eval_bare_aggregate
even if nothing has changed but it wasn't non-constant and removing folding
from the TREE_CONSTANT reduced_constant_expression_p short-cut.
2022-10-21 Jakub Jelinek <jakub@redhat.com>
PR c++/107295
* constexpr.cc (reduced_constant_expression_p) <case CONSTRUCTOR>:
Return false for VECTOR_TYPE CONSTRUCTORs even without
CONSTRUCTOR_NO_CLEARING set on them.
(cxx_eval_bare_aggregate): If constant but !changed, fold before
returning VECTOR_TYPE_P CONSTRUCTOR.
(cxx_eval_constant_expression) <case CONSTRUCTOR>: Don't fold
TREE_CONSTANT CONSTRUCTOR, just return it.
* g++.dg/ext/vector42.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107295] [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
` (7 preceding siblings ...)
2022-10-21 16:07 ` cvs-commit at gcc dot gnu.org
@ 2022-10-21 16:09 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-21 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107295
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-10-21 16:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 12:59 [Bug c++/107295] New: [13 Regression] Rejected code in libreoffice with -m32 since r13-3290-g98e341130f87984a marxin at gcc dot gnu.org
2022-10-17 12:59 ` [Bug c++/107295] " marxin at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:19 ` jakub at gcc dot gnu.org
2022-10-17 13:30 ` marxin at gcc dot gnu.org
2022-10-18 7:55 ` rguenth at gcc dot gnu.org
2022-10-18 10:03 ` jakub at gcc dot gnu.org
2022-10-18 10:55 ` jakub at gcc dot gnu.org
2022-10-21 16:07 ` cvs-commit at gcc dot gnu.org
2022-10-21 16:09 ` jakub 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).