diff mbox

[PR61191,Cilk+] Fix ICE on syntax error

Message ID 0EFAB2BDD0F67E4FB6CCC8B9F87D7569564401E1@IRSMSX101.ger.corp.intel.com
State New
Headers show

Commit Message

Zamyatin, Igor May 21, 2014, 12:48 p.m. UTC
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.


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

Comments

Jeff Law May 21, 2014, 1:05 p.m. UTC | #1
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
diff mbox

Patch

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" } */