[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed.

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Nov 14 12:38:20 2018
New Revision: 266141

URL: https://gcc.gnu.org/viewcvs?rev=266141=gcc=rev
Log:
PR other/88007
* c-common.c (parse_optimize_options): Allocate option string from
opts_obstack rather than as GC memory.  Move the allocation after
warning for invalid option.

* gcc.dg/pr88007.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr88007.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/testsuite/ChangeLog

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška  ---
*** Bug 88016 has been marked as a duplicate of this bug. ***

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-11-14
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Martin Liška  ---
> 
> Using the opts_obstack sounds reasonable to me.
>

Let me do that.

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-14 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

--- Comment #2 from rguenther at suse dot de  ---
On Tue, 13 Nov 2018, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007
> 
> Jakub Jelinek  changed:
> 
>What|Removed |Added
> 
>  CC||jakub at gcc dot gnu.org
> 
> --- Comment #1 from Jakub Jelinek  ---
> This is because parse_optimize_options has:
>   r = q = (char *) ggc_alloc_atomic (len2 + 3);
> and constructs in there the whole option, like "-falign-functions=16" , and
> then options processing comes and points arg into that string (so "16").
> As gcc_options is marked GTY, the const char * fields in there thus need to be
> either not GC memory at all, or they need to point at the start of a GC chunk,
> or into the middle of STRING_CST, everything else is disallowed.
> 
> So, either we need to pass down to the option processing info that the options
> are GC allocated and if we'd have arg pointing into the middle of such a
> string, ggc_strdup it, or maybe c-common.c should use XOBNEWVEC 
> (_obstack,
> char, len2 + 3); instead of (char *) ggc_alloc_atomic (len2 + 3) ?

Using the opts_obstack sounds reasonable to me.

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
This is because parse_optimize_options has:
  r = q = (char *) ggc_alloc_atomic (len2 + 3);
and constructs in there the whole option, like "-falign-functions=16" , and
then options processing comes and points arg into that string (so "16").
As gcc_options is marked GTY, the const char * fields in there thus need to be
either not GC memory at all, or they need to point at the start of a GC chunk,
or into the middle of STRING_CST, everything else is disallowed.

So, either we need to pass down to the option processing info that the options
are GC allocated and if we'd have arg pointing into the middle of such a
string, ggc_strdup it, or maybe c-common.c should use XOBNEWVEC (_obstack,
char, len2 + 3); instead of (char *) ggc_alloc_atomic (len2 + 3) ?

[Bug other/88007] [9 Regression] ICE in gt_ggc_m_S, at ggc-page.c:1474

2018-11-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88007

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org
   Target Milestone|--- |9.0