diff -Nrcpad gcc-4.3.0/gcc/ada/ChangeLog gcc-4.3.1/gcc/ada/ChangeLog *** gcc-4.3.0/gcc/ada/ChangeLog Wed Mar 5 17:43:38 2008 --- gcc-4.3.1/gcc/ada/ChangeLog Fri Jun 6 14:28:20 2008 *************** *** 1,3 **** --- 1,47 ---- + 2008-06-06 Release Manager + + * GCC 4.3.1 released. + + 2008-05-24 Eric Botcazou + + * trans.c (Sloc_to_locus): Do not overwrite known GCC locations when + translating GNAT standard locations. + + 2008-05-17 Eric Botcazou + + * trans.c (gnat_to_gnu) : Account + for dummy types pointed to by the converted pointer types. + + 2008-05-15 Eric Botcazou + + * trans.c (add_decl_expr): At toplevel, mark the TYPE_ADA_SIZE field + of records and unions. + (gnat_to_gnu) : Fix formatting. + + 2008-05-13 Eric Botcazou + + PR ada/24880 + PR ada/26635 + * utils.c (convert) : When converting an additive + expression to an integral type with lower precision, use NOP_EXPR + directly in a couple of special cases. + + 2008-04-09 Eric Botcazou + + * decl.c (is_variable_size): Do not unconditionally return false + on non-strict alignment platforms. + + 2008-04-01 John David Anglin + + PR ada/33857 + * env.c: Always include crt_externs.h if __APPLE__ is defined. + (__gnat_setenv): Use setenv instead of putenv if __APPLE__ is defined. + + 2008-03-31 Eric Botcazou + + * decl.c (gnat_to_gnu_entity) : Do not force a non-null + size if it has overflowed. + 2008-03-05 Release Manager * GCC 4.3.0 released. diff -Nrcpad gcc-4.3.0/gcc/ada/decl.c gcc-4.3.1/gcc/ada/decl.c *** gcc-4.3.0/gcc/ada/decl.c Sat Jan 26 09:29:00 2008 --- gcc-4.3.1/gcc/ada/decl.c Wed Apr 9 16:25:28 2008 *************** gnat_to_gnu_entity (Entity_Id gnat_entit *** 636,643 **** clause, as we would lose useful information on the view size (e.g. for null array slices) and we are not allocating the object here anyway. */ ! if (((gnu_size && integer_zerop (gnu_size)) ! || (TYPE_SIZE (gnu_type) && integer_zerop (TYPE_SIZE (gnu_type)))) && (!Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) || !Is_Array_Type (Etype (gnat_entity))) && !Present (Renamed_Object (gnat_entity)) --- 636,647 ---- clause, as we would lose useful information on the view size (e.g. for null array slices) and we are not allocating the object here anyway. */ ! if (((gnu_size ! && integer_zerop (gnu_size) ! && !TREE_OVERFLOW (gnu_size)) ! || (TYPE_SIZE (gnu_type) ! && integer_zerop (TYPE_SIZE (gnu_type)) ! && !TREE_OVERFLOW (TYPE_SIZE (gnu_type)))) && (!Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) || !Is_Array_Type (Etype (gnat_entity))) && !Present (Renamed_Object (gnat_entity)) *************** is_variable_size (tree type) *** 5864,5881 **** { tree field; ! /* We need not be concerned about this at all if we don't have ! strict alignment. */ ! if (!STRICT_ALIGNMENT) ! return false; ! else if (!TREE_CONSTANT (TYPE_SIZE (type))) return true; ! else if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type) ! && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) return true; ! else if (TREE_CODE (type) != RECORD_TYPE ! && TREE_CODE (type) != UNION_TYPE ! && TREE_CODE (type) != QUAL_UNION_TYPE) return false; for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) --- 5868,5884 ---- { tree field; ! if (!TREE_CONSTANT (TYPE_SIZE (type))) return true; ! ! if (TREE_CODE (type) == RECORD_TYPE ! && TYPE_IS_PADDING_P (type) ! && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) return true; ! ! if (TREE_CODE (type) != RECORD_TYPE ! && TREE_CODE (type) != UNION_TYPE ! && TREE_CODE (type) != QUAL_UNION_TYPE) return false; for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) diff -Nrcpad gcc-4.3.0/gcc/ada/env.c gcc-4.3.1/gcc/ada/env.c *** gcc-4.3.0/gcc/ada/env.c Wed Feb 13 19:04:53 2008 --- gcc-4.3.1/gcc/ada/env.c Tue Apr 1 22:25:02 2008 *************** *** 41,50 **** #include #endif - #if defined (__APPLE__) - #include - #endif - #if defined (__MINGW32__) #include #endif --- 41,46 ---- *************** extern char** ppGlobalEnviron; *** 61,66 **** --- 57,66 ---- #include "system.h" #endif /* IN_RTS */ + #if defined (__APPLE__) + #include + #endif + #include "env.h" void *************** __gnat_setenv (char *name, char *value) *** 166,172 **** LIB$SIGNAL (status); } ! #elif defined (__vxworks) && defined (__RTP__) setenv (name, value, 1); #else --- 166,172 ---- LIB$SIGNAL (status); } ! #elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__) setenv (name, value, 1); #else *************** __gnat_setenv (char *name, char *value) *** 178,184 **** sprintf (expression, "%s=%s", name, value); putenv (expression); #if (defined (__FreeBSD__) && (__FreeBSD__ < 7)) \ ! || defined (__APPLE__) || defined (__MINGW32__) \ ||(defined (__vxworks) && ! defined (__RTP__)) /* On some systems like FreeBSD 6.x and earlier, MacOS X and Windows, putenv is making a copy of the expression string so we can free --- 178,184 ---- sprintf (expression, "%s=%s", name, value); putenv (expression); #if (defined (__FreeBSD__) && (__FreeBSD__ < 7)) \ ! || defined (__MINGW32__) \ ||(defined (__vxworks) && ! defined (__RTP__)) /* On some systems like FreeBSD 6.x and earlier, MacOS X and Windows, putenv is making a copy of the expression string so we can free diff -Nrcpad gcc-4.3.0/gcc/ada/trans.c gcc-4.3.1/gcc/ada/trans.c *** gcc-4.3.0/gcc/ada/trans.c Tue Jan 22 18:15:49 2008 --- gcc-4.3.1/gcc/ada/trans.c Sat May 24 11:52:29 2008 *************** gnat_to_gnu (Node_Id gnat_node) *** 4722,4766 **** break; case N_Validate_Unchecked_Conversion: - /* If the result is a pointer type, see if we are either converting - from a non-pointer or from a pointer to a type with a different - alias set and warn if so. If the result defined in the same unit as - this unchecked conversion, we can allow this because we can know to - make that type have alias set 0. */ { ! tree gnu_source_type = gnat_to_gnu_type (Source_Type (gnat_node)); ! tree gnu_target_type = gnat_to_gnu_type (Target_Type (gnat_node)); ! if (POINTER_TYPE_P (gnu_target_type) ! && !In_Same_Source_Unit (Target_Type (gnat_node), gnat_node) ! && get_alias_set (TREE_TYPE (gnu_target_type)) != 0 ! && !No_Strict_Aliasing (Underlying_Type (Target_Type (gnat_node))) ! && (!POINTER_TYPE_P (gnu_source_type) ! || (get_alias_set (TREE_TYPE (gnu_source_type)) ! != get_alias_set (TREE_TYPE (gnu_target_type))))) ! { ! post_error_ne ! ("?possible aliasing problem for type&", ! gnat_node, Target_Type (gnat_node)); ! post_error ! ("\\?use -fno-strict-aliasing switch for references", ! gnat_node); ! post_error_ne ! ("\\?or use `pragma No_Strict_Aliasing (&);`", ! gnat_node, Target_Type (gnat_node)); } ! /* The No_Strict_Aliasing flag is not propagated to the back-end for ! fat pointers so unconditionally warn in problematic cases. */ else if (TYPE_FAT_POINTER_P (gnu_target_type)) { ! tree array_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_target_type))); ! if (get_alias_set (array_type) != 0 && (!TYPE_FAT_POINTER_P (gnu_source_type) ! || (get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_source_type)))) ! != get_alias_set (array_type)))) { post_error_ne ("?possible aliasing problem for type&", --- 4722,4792 ---- break; case N_Validate_Unchecked_Conversion: { ! Entity_Id gnat_target_type = Target_Type (gnat_node); ! tree gnu_source_type = gnat_to_gnu_type (Source_Type (gnat_node)); ! tree gnu_target_type = gnat_to_gnu_type (gnat_target_type); ! /* No need for any warning in this case. */ ! if (!flag_strict_aliasing) ! ; ! ! /* If the result is a pointer type, see if we are either converting ! from a non-pointer or from a pointer to a type with a different ! alias set and warn if so. If the result is defined in the same ! unit as this unchecked conversion, we can allow this because we ! can know to make the pointer type behave properly. */ ! else if (POINTER_TYPE_P (gnu_target_type) ! && !In_Same_Source_Unit (gnat_target_type, gnat_node) ! && !No_Strict_Aliasing (Underlying_Type (gnat_target_type))) ! { ! tree gnu_source_desig_type = POINTER_TYPE_P (gnu_source_type) ! ? TREE_TYPE (gnu_source_type) ! : NULL_TREE; ! tree gnu_target_desig_type = TREE_TYPE (gnu_target_type); ! ! if ((TYPE_DUMMY_P (gnu_target_desig_type) ! || get_alias_set (gnu_target_desig_type) != 0) ! && (!POINTER_TYPE_P (gnu_source_type) ! || (TYPE_DUMMY_P (gnu_source_desig_type) ! != TYPE_DUMMY_P (gnu_target_desig_type)) ! || (TYPE_DUMMY_P (gnu_source_desig_type) ! && gnu_source_desig_type != gnu_target_desig_type) ! || (get_alias_set (gnu_source_desig_type) ! != get_alias_set (gnu_target_desig_type)))) ! { ! post_error_ne ! ("?possible aliasing problem for type&", ! gnat_node, Target_Type (gnat_node)); ! post_error ! ("\\?use -fno-strict-aliasing switch for references", ! gnat_node); ! post_error_ne ! ("\\?or use `pragma No_Strict_Aliasing (&);`", ! gnat_node, Target_Type (gnat_node)); ! } } ! /* But if the result is a fat pointer type, we have no mechanism to ! do that, so we unconditionally warn in problematic cases. */ else if (TYPE_FAT_POINTER_P (gnu_target_type)) { ! tree gnu_source_array_type ! = TYPE_FAT_POINTER_P (gnu_source_type) ! ? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_source_type))) ! : NULL_TREE; ! tree gnu_target_array_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_target_type))); ! if ((TYPE_DUMMY_P (gnu_target_array_type) ! || get_alias_set (gnu_target_array_type) != 0) && (!TYPE_FAT_POINTER_P (gnu_source_type) ! || (TYPE_DUMMY_P (gnu_source_array_type) ! != TYPE_DUMMY_P (gnu_target_array_type)) ! || (TYPE_DUMMY_P (gnu_source_array_type) ! && gnu_source_array_type != gnu_target_array_type) ! || (get_alias_set (gnu_source_array_type) ! != get_alias_set (gnu_target_array_type)))) { post_error_ne ("?possible aliasing problem for type&", *************** void *** 5000,5006 **** add_decl_expr (tree gnu_decl, Entity_Id gnat_entity) { tree type = TREE_TYPE (gnu_decl); ! tree gnu_stmt, gnu_init, gnu_lhs; /* If this is a variable that Gigi is to ignore, we may have been given an ERROR_MARK. So test for it. We also might have been given a --- 5026,5032 ---- add_decl_expr (tree gnu_decl, Entity_Id gnat_entity) { tree type = TREE_TYPE (gnu_decl); ! tree gnu_stmt, gnu_init, t; /* If this is a variable that Gigi is to ignore, we may have been given an ERROR_MARK. So test for it. We also might have been given a *************** add_decl_expr (tree gnu_decl, Entity_Id *** 5019,5025 **** if (global_bindings_p ()) { /* Mark everything as used to prevent node sharing with subprograms. ! Note that walk_tree knows how to handle TYPE_DECL, but neither VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */ walk_tree (&gnu_stmt, mark_visited, NULL, NULL); if (TREE_CODE (gnu_decl) == VAR_DECL --- 5045,5051 ---- if (global_bindings_p ()) { /* Mark everything as used to prevent node sharing with subprograms. ! Note that walk_tree knows how to deal with TYPE_DECL, but neither VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */ walk_tree (&gnu_stmt, mark_visited, NULL, NULL); if (TREE_CODE (gnu_decl) == VAR_DECL *************** add_decl_expr (tree gnu_decl, Entity_Id *** 5029,5034 **** --- 5055,5067 ---- walk_tree (&DECL_SIZE_UNIT (gnu_decl), mark_visited, NULL, NULL); walk_tree (&DECL_INITIAL (gnu_decl), mark_visited, NULL, NULL); } + /* In any case, we have to deal with our own TYPE_ADA_SIZE field. */ + if (TREE_CODE (gnu_decl) == TYPE_DECL + && (TREE_CODE (type) == RECORD_TYPE + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) + && (t = TYPE_ADA_SIZE (type))) + walk_tree (&t, mark_visited, NULL, NULL); } else add_stmt_with_node (gnu_stmt, gnat_entity); *************** add_decl_expr (tree gnu_decl, Entity_Id *** 5045,5055 **** /* If GNU_DECL has a padded type, convert it to the unpadded type so the assignment is done properly. */ if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type)) ! gnu_lhs = convert (TREE_TYPE (TYPE_FIELDS (type)), gnu_decl); else ! gnu_lhs = gnu_decl; ! gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_lhs, gnu_init); DECL_INITIAL (gnu_decl) = NULL_TREE; if (TREE_READONLY (gnu_decl)) --- 5078,5088 ---- /* If GNU_DECL has a padded type, convert it to the unpadded type so the assignment is done properly. */ if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type)) ! t = convert (TREE_TYPE (TYPE_FIELDS (type)), gnu_decl); else ! t = gnu_decl; ! gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, t, gnu_init); DECL_INITIAL (gnu_decl) = NULL_TREE; if (TREE_READONLY (gnu_decl)) *************** Sloc_to_locus (Source_Ptr Sloc, location *** 6652,6658 **** if (Sloc <= Standard_Location) #ifdef USE_MAPPED_LOCATION { ! *locus = BUILTINS_LOCATION; return false; } else --- 6685,6692 ---- if (Sloc <= Standard_Location) #ifdef USE_MAPPED_LOCATION { ! if (*locus == UNKNOWN_LOCATION) ! *locus = BUILTINS_LOCATION; return false; } else diff -Nrcpad gcc-4.3.0/gcc/ada/utils.c gcc-4.3.1/gcc/ada/utils.c *** gcc-4.3.0/gcc/ada/utils.c Thu Jan 17 16:04:10 2008 --- gcc-4.3.1/gcc/ada/utils.c Tue May 13 08:46:49 2008 *************** convert (tree type, tree expr) *** 3575,3581 **** if (TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert_to_fat_pointer (type, expr); ! /* If we're converting between two aggregate types that have the same main variant, just make a VIEW_CONVER_EXPR. */ else if (AGGREGATE_TYPE_P (type) && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) --- 3575,3581 ---- if (TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert_to_fat_pointer (type, expr); ! /* If we are converting between two aggregate types that have the same main variant, just make a VIEW_CONVER_EXPR. */ else if (AGGREGATE_TYPE_P (type) && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype)) *************** convert (tree type, tree expr) *** 3609,3614 **** --- 3609,3638 ---- /* ... fall through ... */ case ENUMERAL_TYPE: + /* If we are converting an additive expression to an integer type + with lower precision, be wary of the optimization that can be + applied by convert_to_integer. There are 2 problematic cases: + - if the first operand was originally of a biased type, + because we could be recursively called to convert it + to an intermediate type and thus rematerialize the + additive operator endlessly, + - if the expression contains a placeholder, because an + intermediate conversion that changes the sign could + be inserted and thus introduce an artificial overflow + at compile time when the placeholder is substituted. */ + if (code == INTEGER_TYPE + && ecode == INTEGER_TYPE + && TYPE_PRECISION (type) < TYPE_PRECISION (etype) + && (TREE_CODE (expr) == PLUS_EXPR || TREE_CODE (expr) == MINUS_EXPR)) + { + tree op0 = get_unwidened (TREE_OPERAND (expr, 0), type); + + if ((TREE_CODE (TREE_TYPE (op0)) == INTEGER_TYPE + && TYPE_BIASED_REPRESENTATION_P (TREE_TYPE (op0))) + || CONTAINS_PLACEHOLDER_P (expr)) + return build1 (NOP_EXPR, type, expr); + } + return fold (convert_to_integer (type, expr)); case POINTER_TYPE: diff -Nrcpad gcc-4.3.0/gnattools/ChangeLog gcc-4.3.1/gnattools/ChangeLog *** gcc-4.3.0/gnattools/ChangeLog Wed Mar 5 17:43:58 2008 --- gcc-4.3.1/gnattools/ChangeLog Fri Jun 6 14:28:04 2008 *************** *** 1,3 **** --- 1,7 ---- + 2008-06-06 Release Manager + + * GCC 4.3.1 released. + 2008-03-05 Release Manager * GCC 4.3.0 released. diff -Nrcpad gcc-4.3.0/libada/ChangeLog gcc-4.3.1/libada/ChangeLog *** gcc-4.3.0/libada/ChangeLog Wed Mar 5 17:44:09 2008 --- gcc-4.3.1/libada/ChangeLog Fri Jun 6 14:27:59 2008 *************** *** 1,3 **** --- 1,7 ---- + 2008-06-06 Release Manager + + * GCC 4.3.1 released. + 2008-03-05 Release Manager * GCC 4.3.0 released.