This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/78501] [7 regression] SEGV in vrp_val_max
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 24 Nov 2016 10:18:42 +0000
- Subject: [Bug middle-end/78501] [7 regression] SEGV in vrp_val_max
- Auto-submitted: auto-generated
- References: <bug-78501-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78501
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or perhaps check ptrdiff_type_node != NULL && TYPE_PRECISION
(ptrdiff_type_node) == TYPE_PRECISION (size_type_node) before trying to
optimize this?
I mean, on VMS it might be fine if strlen returns 0xfffffffe (maximum size_t
minus 1), if the address space is 64-bit and so is ptrdiff_t.
So the above would only optimize on sane targets.
The other uses of ptrdiff_type_node in the middle-end, which need fixing
anyway, would need something like your patch, but not sure if it is not a waste
of time to compute it if the C/C++ FE will immediately override it anyway.
So perhaps just compute it that way in the LTO FE?
I mean, for the *printf warning/length stuff, those calls shouldn't appear in
Ada/Go/Fortran code, they can in LTO or C-family.
The gimple-ssa-sprintf.c code could just check if ptrdiff_type_node is non-NULL
and if it is NULL, punt.