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 08:23:23 +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 #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> (In reply to prathamesh3492 from comment #2)
> > Hi,
> > From the trace, it seems ptrdiff_type_node is set to NULL for ada ?
> > Either we can guard setting range for CFN_BUILTIN_STRLEN by checking
> > ptrtdiff_type_node is non null, or make vrp_val_max return NULL if type is
> > NULL.
> > I am trying to reproduce on x86_64-unknown-linux-gnu.
> >
> > Thanks,
> > Prathamesh
>
> Looks like gimple-ssa-sprintf.c also unconditionally uses it.
>
> I suppose we should move its initialization to build_common_tree_nodes,
> it's built from the PTRDIFF_TYPE target macro. See how size_type_node is
> built.
> Also move unsigned_ptrdiff_type_node.
The way gimple-ssa-sprintf.c uses it looks just wrong to me.
case FMT_LEN_z:
dirtype = sign ? ptrdiff_type_node : size_type_node;
break;
case FMT_LEN_t:
dirtype = sign ? ptrdiff_type_node : size_type_node;
break;
From what I can see in POSIX, it should be
case FMT_LEN_z:
dirtype = sign ? signed_type_for (size_type_node) : size_type_node;
break;
case FMT_LEN_t:
dirtype = sign ? ptrdiff_type_node : unsigned_type_for
(ptrdiff_type_node);
break;