public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, PR61191, Cilk+] Fix ICE on syntax error
@ 2014-05-20 14:32 Zamyatin, Igor
  2014-05-20 15:27 ` H.J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Zamyatin, Igor @ 2014-05-20 14:32 UTC (permalink / raw)
  To: GCC Patches (gcc-patches@gcc.gnu.org)

Hi all!

The following patch fixes the ICE for the cilk code with syntax error.

Regtested on x86_64.
Ok for trunk and 4.9?

Thanks,
Igor


gcc/c/ChangeLog:

2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>

* c-array-notation.c (fix_builtin_array_notation_fn): Check invalid  
function parameters.


diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 0ac6ba8..127f9a1 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -229,6 +229,8 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
   /* Fully fold any EXCESSIVE_PRECISION EXPR that can occur in the function
      parameter.  */
   func_parm = c_fully_fold (func_parm, false, NULL);
+  if (func_parm == error_mark_node)
+    return error_mark_node;
   
   location = EXPR_LOCATION (an_builtin_fn);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error
  2014-05-20 14:32 [PATCH, PR61191, Cilk+] Fix ICE on syntax error Zamyatin, Igor
@ 2014-05-20 15:27 ` H.J. Lu
  2014-05-20 16:36   ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2014-05-20 15:27 UTC (permalink / raw)
  To: Zamyatin, Igor; +Cc: GCC Patches (gcc-patches@gcc.gnu.org)

On Tue, May 20, 2014 at 7:31 AM, Zamyatin, Igor <igor.zamyatin@intel.com> wrote:
> Hi all!
>
> The following patch fixes the ICE for the cilk code with syntax error.
>
> Regtested on x86_64.
> Ok for trunk and 4.9?
>
> Thanks,
> Igor
>
>
> gcc/c/ChangeLog:
>
> 2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>
>
> * c-array-notation.c (fix_builtin_array_notation_fn): Check invalid
> function parameters.
>
>
> diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
> index 0ac6ba8..127f9a1 100644
> --- a/gcc/c/c-array-notation.c
> +++ b/gcc/c/c-array-notation.c
> @@ -229,6 +229,8 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
>    /* Fully fold any EXCESSIVE_PRECISION EXPR that can occur in the function
>       parameter.  */
>    func_parm = c_fully_fold (func_parm, false, NULL);
> +  if (func_parm == error_mark_node)
> +    return error_mark_node;
>
>    location = EXPR_LOCATION (an_builtin_fn);
>

You should include a testcase.


-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error
  2014-05-20 15:27 ` H.J. Lu
@ 2014-05-20 16:36   ` Jeff Law
  2014-05-21 12:49     ` Zamyatin, Igor
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2014-05-20 16:36 UTC (permalink / raw)
  To: H.J. Lu, Zamyatin, Igor; +Cc: GCC Patches (gcc-patches@gcc.gnu.org)

On 05/20/14 09:27, H.J. Lu wrote:
> On Tue, May 20, 2014 at 7:31 AM, Zamyatin, Igor <igor.zamyatin@intel.com> wrote:
>> Hi all!
>>
>> The following patch fixes the ICE for the cilk code with syntax error.
>>
>> Regtested on x86_64.
>> Ok for trunk and 4.9?
>>
>> Thanks,
>> Igor
>>
>>
>> gcc/c/ChangeLog:
>>
>> 2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>
>>
>> * c-array-notation.c (fix_builtin_array_notation_fn): Check invalid
>> function parameters.
>>
>>
>> diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
>> index 0ac6ba8..127f9a1 100644
>> --- a/gcc/c/c-array-notation.c
>> +++ b/gcc/c/c-array-notation.c
>> @@ -229,6 +229,8 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
>>     /* Fully fold any EXCESSIVE_PRECISION EXPR that can occur in the function
>>        parameter.  */
>>     func_parm = c_fully_fold (func_parm, false, NULL);
>> +  if (func_parm == error_mark_node)
>> +    return error_mark_node;
>>
>>     location = EXPR_LOCATION (an_builtin_fn);
>>
>
> You should include a testcase.
Agreed.  This definitely should include a testcase.

jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH, PR61191, Cilk+] Fix ICE on syntax error
  2014-05-20 16:36   ` Jeff Law
@ 2014-05-21 12:49     ` Zamyatin, Igor
  2014-05-21 13:05       ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Zamyatin, Igor @ 2014-05-21 12:49 UTC (permalink / raw)
  To: Jeff Law, H.J. Lu; +Cc: GCC Patches (gcc-patches@gcc.gnu.org)

Please see the patch with the testcase

Thanks,
Igor

gcc/c/ChangeLog:

2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>

PR c/61191
* c-array-notation.c (fix_builtin_array_notation_fn): Check invalid
function parameters.

gcc/testsuite/ChangeLog

2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>

PR c/61191
* c-c++-common/cilk-plus/AN/pr61191.c: Check for correct
handling of the case with syntax error.

diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 0ac6ba8..127f9a1 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -229,6 +229,8 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
   /* Fully fold any EXCESSIVE_PRECISION EXPR that can occur in the function
      parameter.  */
   func_parm = c_fully_fold (func_parm, false, NULL);
+  if (func_parm == error_mark_node)
+    return error_mark_node;
   
   location = EXPR_LOCATION (an_builtin_fn);
   
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c
new file mode 100644
index 0000000..e27819b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c
@@ -0,0 +1,10 @@
+/* PR c/61191 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+double f(double * A, double * B)
+{
+  return __sec_reduce_add((B[0:500])(;
+/* { dg-error "expected expression before ';' token" "" {target *-*-*} 7 } */
+/* { dg-error "called object" "" {target *-*-*} 7 } */
+} /* { dg-error "expected" } */

> -----Original Message-----
> From: Jeff Law [mailto:law@redhat.com]
> Sent: Tuesday, May 20, 2014 8:36 PM
> To: H.J. Lu; Zamyatin, Igor
> Cc: GCC Patches (gcc-patches@gcc.gnu.org)
> Subject: Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error
> 
> On 05/20/14 09:27, H.J. Lu wrote:
> > On Tue, May 20, 2014 at 7:31 AM, Zamyatin, Igor
> <igor.zamyatin@intel.com> wrote:
> >> Hi all!
> >>
> >> The following patch fixes the ICE for the cilk code with syntax error.
> >>
> >> Regtested on x86_64.
> >> Ok for trunk and 4.9?
> >>
> >> Thanks,
> >> Igor
> >>
> >>
> >> gcc/c/ChangeLog:
> >>
> >> 2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>
> >>
> >> * c-array-notation.c (fix_builtin_array_notation_fn): Check invalid
> >> function parameters.
> >>
> >>
> >> diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
> >> index 0ac6ba8..127f9a1 100644
> >> --- a/gcc/c/c-array-notation.c
> >> +++ b/gcc/c/c-array-notation.c
> >> @@ -229,6 +229,8 @@ fix_builtin_array_notation_fn (tree an_builtin_fn,
> tree *new_var)
> >>     /* Fully fold any EXCESSIVE_PRECISION EXPR that can occur in the
> function
> >>        parameter.  */
> >>     func_parm = c_fully_fold (func_parm, false, NULL);
> >> +  if (func_parm == error_mark_node)
> >> +    return error_mark_node;
> >>
> >>     location = EXPR_LOCATION (an_builtin_fn);
> >>
> >
> > You should include a testcase.
> Agreed.  This definitely should include a testcase.
> 
> jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error
  2014-05-21 12:49     ` Zamyatin, Igor
@ 2014-05-21 13:05       ` Jeff Law
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Law @ 2014-05-21 13:05 UTC (permalink / raw)
  To: Zamyatin, Igor, H.J. Lu; +Cc: GCC Patches (gcc-patches@gcc.gnu.org)

On 05/21/14 06:48, Zamyatin, Igor wrote:
> Please see the patch with the testcase
>
> Thanks,
> Igor
>
> gcc/c/ChangeLog:
>
> 2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>
>
> PR c/61191
> * c-array-notation.c (fix_builtin_array_notation_fn): Check invalid
> function parameters.
>
> gcc/testsuite/ChangeLog
>
> 2014-05-20  Igor Zamyatin  <igor.zamyatin@intel.com>
>
> PR c/61191
> * c-c++-common/cilk-plus/AN/pr61191.c: Check for correct
> handling of the case with syntax error.
This is fine. Please install.

Thanks,
Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-21 13:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-20 14:32 [PATCH, PR61191, Cilk+] Fix ICE on syntax error Zamyatin, Igor
2014-05-20 15:27 ` H.J. Lu
2014-05-20 16:36   ` Jeff Law
2014-05-21 12:49     ` Zamyatin, Igor
2014-05-21 13:05       ` Jeff Law

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).