Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error

2014-05-21 Thread Jeff Law

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  

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

gcc/testsuite/ChangeLog

2014-05-20  Igor Zamyatin  

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



RE: [PATCH, PR61191, Cilk+] Fix ICE on syntax error

2014-05-21 Thread Zamyatin, Igor
Please see the patch with the testcase

Thanks,
Igor

gcc/c/ChangeLog:

2014-05-20  Igor Zamyatin  

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

gcc/testsuite/ChangeLog

2014-05-20  Igor Zamyatin  

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 000..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:l...@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
>  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  
> >>
> >> * 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


Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error

2014-05-20 Thread Jeff Law

On 05/20/14 09:27, H.J. Lu wrote:

On Tue, May 20, 2014 at 7:31 AM, Zamyatin, Igor  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  

* 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


Re: [PATCH, PR61191, Cilk+] Fix ICE on syntax error

2014-05-20 Thread H.J. Lu
On Tue, May 20, 2014 at 7:31 AM, Zamyatin, Igor  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  
>
> * 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.