[Bug c/31871] C99 failure to diagnose non-integer cast

2009-03-29 Thread jsm28 at gcc dot gnu dot org


--- Comment #5 from jsm28 at gcc dot gnu dot org  2009-03-29 18:14 ---
Subject: Bug 31871

Author: jsm28
Date: Sun Mar 29 18:13:43 2009
New Revision: 145254

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=145254
Log:
PR c/456
PR c/5675
PR c/19976
PR c/29116
PR c/31871
PR c/35198

fixincludes:
* inclhack.def (glibc_tgmath): New fix.
* fixincl.x: Regenerate.
* tests/base/tgmath.h: New.

gcc:
* builtins.c (fold_builtin_sincos): Build COMPOUND_EXPR in
void_type_node.
(fold_call_expr): Return a NOP_EXPR from folding rather than the
contained expression.
* c-common.c (c_fully_fold, c_fully_fold_internal, c_save_expr):
New.
(c_common_truthvalue_conversion): Use c_save_expr.  Do not fold
conditional expressions for C.
(decl_constant_value_for_optimization): Move from
decl_constant_value_for_broken_optimization in c-typeck.c.  Check
whether optimizing and that the expression is a VAR_DECL not of
array type instead of doing such checks in the caller.  Do not
check pedantic.  Call gcc_unreachable for C++.
* c-common.def (C_MAYBE_CONST_EXPR): New.
* c-common.h (c_fully_fold, c_save_expr,
decl_constant_value_for_optimization): New prototypes.
(C_MAYBE_CONST_EXPR_PRE, C_MAYBE_CONST_EXPR_EXPR,
C_MAYBE_CONST_EXPR_INT_OPERANDS, C_MAYBE_CONST_EXPR_NON_CONST,
EXPR_INT_CONST_OPERANDS): Define.
* c-convert.c (convert): Strip nops from expression.
* c-decl.c (groktypename): Take extra parameters expr and
expr_const_operands.  Update call to grokdeclarator.
(start_decl): Update call to grokdeclarator.  Add statement for
expressions used in type of decl.
(grokparm): Update call to grokdeclarator.
(push_parm_decl): Update call to grokdeclarator.
(build_compound_literal): Add parameter non_const and build a
C_MAYBE_COSNT_EXPR if applicable.
(grokdeclarator): Take extra parameters expr and
expr_const_operands.  Track expressions used in declaration
specifiers and declarators.  Fold array sizes and track whether
they are constant expressions and whether they are integer
constant expressions.
(parser_xref_tag): Set expr and expr_const_operands fields in
return value.
(grokfield): Update call to grokdeclarator.
(start_function): Update call to grokdeclarator.
(build_null_declspecs): Set expr and expr_const_operands fields in
return value.
(declspecs_add_type): Handle expressions in typeof specifiers.
* c-parser.c (c_parser_declspecs): Set expr and
expr_const_operands fields for declaration specifiers.
(c_parser_enum_specifier): Likewise.
(c_parser_struct_or_union_specifier): Likewise.
(c_parser_typeof_specifier): Likewise.  Update call to
groktypename.  Fold expression as needed.  Return expressions with
type instead of adding statements.
(c_parser_attributes): Update calls to c_parser_expr_list.
(c_parser_statement_after_labels): Fold expression before passing
to objc_build_throw_stmt.
(c_parser_condition): Fold expression.
(c_parser_asm_operands): Fold expression.
(c_parser_conditional_expression): Use c_save_expr.  Update call
to build_conditional_expr.
(c_parser_alignof_expression): Update call to groktypename.
(c_parser_postfix_expression): Preserve C_MAYBE_CONST_EXPR as
original_code.  Fold expression argument of va_arg.  Create
C_MAYBE_CONST_EXPR to preserve side effects of expressions in type
argument to va_arg.  Update calls to groktypename.  Fold array
index for offsetof.  Verify that first argument to
__builtin_choose_expr has integer type.
(c_parser_postfix_expression_after_paren_type): Update calls to
groktypename and build_compound_literal.  Handle expressions with
side effects in type name.
(c_parser_postfix_expression_after_primary): Update call to
c_parser_expr_list.  Set original_code for calls to
__builtin_constant_p.
(c_parser_expr_list): Take extra parameter fold_p.  Fold
expressions if requested.
(c_parser_objc_type_name): Update call to groktypename.
(c_parser_objc_synchronized_statement): Fold expression.
(c_parser_objc_receiver): Fold expression.
(c_parser_objc_keywordexpr): Update call to c_parser_expr_list.
(c_parser_omp_clause_num_threads, c_parser_omp_clause_schedule,
c_parser_omp_atomic, c_parser_omp_for_loop): Fold expressions.
* c-tree.h (CONSTRUCTOR_NON_CONST): Define.
(struct c_typespec): Add elements expr and expr_const_operands.
(struct c_declspecs): Add elements expr and expr_const_operands.

[Bug c/31871] C99 failure to diagnose non-integer cast

2009-03-29 Thread jsm28 at gcc dot gnu dot org


--- Comment #6 from jsm28 at gcc dot gnu dot org  2009-03-29 18:22 ---
Fixed for 4.5.


-- 

jsm28 at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871



[Bug c/31871] C99 failure to diagnose non-integer cast

2008-10-24 Thread jsm28 at gcc dot gnu dot org


--- Comment #4 from jsm28 at gcc dot gnu dot org  2008-10-24 19:36 ---
Subject: Bug 31871

Author: jsm28
Date: Fri Oct 24 19:34:52 2008
New Revision: 141349

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=141349
Log:
PR c/456
PR c/5675
PR c/19976
PR c/29116
PR c/31871
PR c/35198

fixincludes:
* inclhack.def (glibc_tgmath): New fix.
* fixincl.x: Regenerate.
* tests/base/tgmath.h: New.

gcc:
* builtins.c (fold_call_expr): Return a NOP_EXPR from folding
rather than the contained expression.
* c-common.c (c_save_expr): New.
(c_common_truthvalue_conversion): Use c_save_expr.  Do not fold
conditional expressions for C.
* c-common.def (C_MAYBE_CONST_EXPR): New.
* c-common.h (c_fully_fold, c_save_expr): New prototypes.
(C_MAYBE_CONST_EXPR_PRE, C_MAYBE_CONST_EXPR_EXPR,
C_MAYBE_CONST_EXPR_INT_OPERANDS, C_MAYBE_CONST_EXPR_NON_CONST,
EXPR_INT_CONST_OPERANDS): Define.
* c-convert.c (convert): Strip nops from expression.
* c-decl.c (groktypename): Take extra parameters expr and
expr_const_operands.  Update call to grokdeclarator.
(start_decl): Update call to grokdeclarator.  Add statement for
expressions used in type of decl.
(grokparm): Update call to grokdeclarator.
(push_parm_decl): Update call to grokdeclarator.
(build_compound_literal): Add parameter non_const and build a
C_MAYBE_COSNT_EXPR if applicable.
(grokdeclarator): Take extra parameters expr and
expr_const_operands.  Track expressions used in declaration
specifiers and declarators.  Fold array sizes and track whether
they are constant expressions and whether they are integer
constant expressions.
(parser_xref_tag): Set expr and expr_const_operands fields in
return value.
(grokfield): Update call to grokdeclarator.
(start_function): Update call to grokdeclarator.
(build_null_declspecs): Set expr and expr_const_operands fields in
return value.
(declspecs_add_type): Handle expressions in typeof specifiers.
* c-parser.c (c_parser_declspecs): Set expr and
expr_const_operands fields for declaration specifiers.
(c_parser_enum_specifier): Likewise.
(c_parser_struct_or_union_specifier): Likewise.
(c_parser_typeof_specifier): Likewise.  Update call to
groktypename.  Fold expression as needed.  Return expressions with
type instead of adding statements.
(c_parser_attributes): Update calls to c_parser_expr_list.
(c_parser_statement_after_labels): Fold expression before passing
to objc_build_throw_stmt.
(c_parser_condition): Fold expression.
(c_parser_asm_operands): Fold expression.
(c_parser_conditional_expression): Use c_save_expr.  Update call
to build_conditional_expr.
(c_parser_alignof_expression): Update call to groktypename.
(c_parser_postfix_expression): Preserve C_MAYBE_CONST_EXPR as
original_code.  Fold expression argument of va_arg.  Create
C_MAYBE_CONST_EXPR to preserve side effects of expressions in type
argument to va_arg.  Update calls to groktypename.  Fold array
index for offsetof.  Verify that first argument to
__builtin_choose_expr has integer type.
(c_parser_postfix_expression_after_paren_type): Update calls to
groktypename and build_compound_literal.  Handle expressions with
side effects in type name.
(c_parser_postfix_expression_after_primary): Update call to
c_parser_expr_list.  Set original_code for calls to
__builtin_constant_p.
(c_parser_expr_list): Take extra parameter fold_p.  Fold
expressions if requested.
(c_parser_objc_type_name): Update call to groktypename.
(c_parser_objc_synchronized_statement): Fold expression.
(c_parser_objc_receiver): Fold expression.
(c_parser_objc_keywordexpr): Update call to c_parser_expr_list.
(c_parser_omp_clause_num_threads, c_parser_omp_clause_schedule,
c_parser_omp_atomic, c_parser_omp_for_loop): Fold expressions.
* c-tree.h (CONSTRUCTOR_NON_CONST): Define.
(struct c_typespec): Add elements expr and expr_const_operands.
(struct c_declspecs): Add elements expr and expr_const_operands.
(groktypename, build_conditional_expr, build_compound_literal):
Update prototypes.
* c-typeck.c (c_fully_fold, c_fully_fold_internal,
note_integer_operands): New functions.
(decl_constant_value_for_broken_optimization): Rename to
decl_constant_value_for_optimization:  Check whether optimizing
and that the expression is a VAR_DECL not of array type instead of
doing such checks in the caller.  Do not check pedantic.

[Bug c/31871] C99 failure to diagnose non-integer cast

2008-10-23 Thread jsm28 at gcc dot gnu dot org


--- Comment #3 from jsm28 at gcc dot gnu dot org  2008-10-24 00:08 ---
Testing a patch for 4.5.


-- 

jsm28 at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jsm28 at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2007-06-24 03:46:49 |2008-10-24 00:08:51
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871



[Bug c/31871] C99 failure to diagnose non-integer cast

2007-06-23 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2007-06-24 03:46 ---
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-06-24 03:46:49
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871



[Bug c/31871] C99 failure to diagnose non-integer cast

2007-05-08 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2007-05-09 03:07 ---
Related to PR 29116.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31871