Re: [PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-09-04 Thread Tom de Vries

On 03/09/16 17:37, Andreas Schwab wrote:

On Aug 24 2016, Tom de Vries  wrote:


> Replace error_at with assert in build_va_arg
>
> 2016-08-22  Tom de Vries  
>
>* c-common.c (build_va_arg): Replace first argument type error
>with assert.

/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c: In function 'void 
fn1()':
/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c:8:31: internal 
compiler error: in build_va_arg, at c-family/c-common.c:5837


Hi,

I build gcc for ppc64 far enough to reproduce it.

The error disappears when reverting the patch.

The error also disappears when applying the fix for PR71602 (awaiting 
approval at https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01981.html).


I've revert the patch on trunk, and will merge it with the fix for PR71602.

Thanks,
- Tom


Re: [PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-09-03 Thread Andreas Schwab
http://gcc.gnu.org/ml/gcc-testresults/2016-09/msg00298.html

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-09-03 Thread Tom de Vries

On 03/09/16 17:37, Andreas Schwab wrote:

On Aug 24 2016, Tom de Vries  wrote:


> Replace error_at with assert in build_va_arg
>
> 2016-08-22  Tom de Vries  
>
>* c-common.c (build_va_arg): Replace first argument type error
>with assert.

/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c: In function 'void 
fn1()':
/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c:8:31: internal 
compiler error: in build_va_arg, at c-family/c-common.c:5837
0x103a856b build_va_arg(unsigned int, tree_node*, tree_node*)
../../gcc/c-family/c-common.c:5837
0x101c8eaf build_x_va_arg(unsigned int, tree_node*, tree_node*)
../../gcc/cp/call.c:6986
0x1028cef3 cp_parser_primary_expression
../../gcc/cp/parser.c:5096
0x1028f6cf cp_parser_postfix_expression
../../gcc/cp/parser.c:6721
0x102981cb cp_parser_unary_expression
../../gcc/cp/parser.c:8019
0x10298ad7 cp_parser_cast_expression
../../gcc/cp/parser.c:8696
0x10299267 cp_parser_binary_expression
../../gcc/cp/parser.c:8797
0x10299acf cp_parser_assignment_expression
../../gcc/cp/parser.c:9084
0x1029c9d7 cp_parser_expression
../../gcc/cp/parser.c:9253
0x1029d477 cp_parser_expression_statement
../../gcc/cp/parser.c:10736
0x1028aeb3 cp_parser_statement
../../gcc/cp/parser.c:10587
0x1028bdcf cp_parser_statement_seq_opt
../../gcc/cp/parser.c:10859
0x1028bed7 cp_parser_compound_statement
../../gcc/cp/parser.c:10813
0x102a9e4f cp_parser_function_body
../../gcc/cp/parser.c:20832
0x102a9e4f cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:20868
0x102aa8eb cp_parser_function_definition_after_declarator
../../gcc/cp/parser.c:25565
0x102ab827 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/cp/parser.c:25477
0x102ab827 cp_parser_init_declarator
../../gcc/cp/parser.c:18603
0x102abaa3 cp_parser_simple_declaration
../../gcc/cp/parser.c:12487
0x102abf23 cp_parser_block_declaration
../../gcc/cp/parser.c:12363
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
compiler exited with status 1
FAIL: c-c++-common/pr70651.c  -std=c++11 (internal compiler error)


Sorry, I need more data to reproduce this. Works for me with x86_64 
-m64/-m32 at r239971.


Thanks,
- Tom


Re: [PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-09-03 Thread Andreas Schwab
On Aug 24 2016, Tom de Vries  wrote:

> Replace error_at with assert in build_va_arg
>
> 2016-08-22  Tom de Vries  
>
>   * c-common.c (build_va_arg): Replace first argument type error
>   with assert.

/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c: In function 'void 
fn1()':
/daten/gcc/gcc-20160902/gcc/testsuite/c-c++-common/pr70651.c:8:31: internal 
compiler error: in build_va_arg, at c-family/c-common.c:5837
0x103a856b build_va_arg(unsigned int, tree_node*, tree_node*)
../../gcc/c-family/c-common.c:5837
0x101c8eaf build_x_va_arg(unsigned int, tree_node*, tree_node*)
../../gcc/cp/call.c:6986
0x1028cef3 cp_parser_primary_expression
../../gcc/cp/parser.c:5096
0x1028f6cf cp_parser_postfix_expression
../../gcc/cp/parser.c:6721
0x102981cb cp_parser_unary_expression
../../gcc/cp/parser.c:8019
0x10298ad7 cp_parser_cast_expression
../../gcc/cp/parser.c:8696
0x10299267 cp_parser_binary_expression
../../gcc/cp/parser.c:8797
0x10299acf cp_parser_assignment_expression
../../gcc/cp/parser.c:9084
0x1029c9d7 cp_parser_expression
../../gcc/cp/parser.c:9253
0x1029d477 cp_parser_expression_statement
../../gcc/cp/parser.c:10736
0x1028aeb3 cp_parser_statement
../../gcc/cp/parser.c:10587
0x1028bdcf cp_parser_statement_seq_opt
../../gcc/cp/parser.c:10859
0x1028bed7 cp_parser_compound_statement
../../gcc/cp/parser.c:10813
0x102a9e4f cp_parser_function_body
../../gcc/cp/parser.c:20832
0x102a9e4f cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:20868
0x102aa8eb cp_parser_function_definition_after_declarator
../../gcc/cp/parser.c:25565
0x102ab827 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/cp/parser.c:25477
0x102ab827 cp_parser_init_declarator
../../gcc/cp/parser.c:18603
0x102abaa3 cp_parser_simple_declaration
../../gcc/cp/parser.c:12487
0x102abf23 cp_parser_block_declaration
../../gcc/cp/parser.c:12363
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
compiler exited with status 1
FAIL: c-c++-common/pr70651.c  -std=c++11 (internal compiler error)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-08-29 Thread Joseph Myers
On Wed, 24 Aug 2016, Tom de Vries wrote:

> Hi,
> 
> at the start of build_va_arg, we error out if there's an invalid va_list
> argument.
> 
> Therefore, the following checks on va_list type are not user errors, but
> internal errors.
> 
> This patch changes the user errors into internal errors.
> 
> Bootstrapped and reg-tested on x86_64.
> 
> OK for trunk?

OK.

-- 
Joseph S. Myers
jos...@codesourcery.com


[PATCH, 2/4] Replace error_at with assert in build_va_arg

2016-08-24 Thread Tom de Vries

Hi,

at the start of build_va_arg, we error out if there's an invalid va_list 
argument.


Therefore, the following checks on va_list type are not user errors, but 
internal errors.


This patch changes the user errors into internal errors.

Bootstrapped and reg-tested on x86_64.

OK for trunk?

Thanks,
- Tom
Replace error_at with assert in build_va_arg

2016-08-22  Tom de Vries  

	* c-common.c (build_va_arg): Replace first argument type error
	with assert.

---
 gcc/c-family/c-common.c | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 7ad1930..a289d2b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5820,12 +5820,7 @@ build_va_arg (location_t loc, tree expr, tree type)
   /* Verify that  is still recognized as having va_list type.  */
   tree canon_expr_type
 	= targetm.canonical_va_list_type (TREE_TYPE (expr));
-  if (canon_expr_type == NULL_TREE)
-	{
-	  error_at (loc,
-		"first argument to % not of type %");
-	  return error_mark_node;
-	}
+  gcc_assert (canon_expr_type != NULL_TREE);
 
   return build_va_arg_1 (loc, type, expr);
 }
@@ -5893,12 +5888,7 @@ build_va_arg (location_t loc, tree expr, tree type)
   /* Verify that  is still recognized as having va_list type.  */
   tree canon_expr_type
 	= targetm.canonical_va_list_type (TREE_TYPE (expr));
-  if (canon_expr_type == NULL_TREE)
-	{
-	  error_at (loc,
-		"first argument to % not of type %");
-	  return error_mark_node;
-	}
+  gcc_assert (canon_expr_type != NULL_TREE);
 }
   else
 {