Deleted Added
full compact
c-common.c (259405) c-common.c (259584)
1/* Subroutines shared by all languages that are variants of C.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 902 unchanged lines hidden (view full) ---

911 || TREE_CODE (value) == VECTOR_CST
912 || TREE_CODE (value) == COMPLEX_CST)
913 && TREE_CONSTANT_OVERFLOW (value)
914 && warn_overflow
915 && pedantic)
916 pedwarn ("overflow in constant expression");
917}
918
1/* Subroutines shared by all languages that are variants of C.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 902 unchanged lines hidden (view full) ---

911 || TREE_CODE (value) == VECTOR_CST
912 || TREE_CODE (value) == COMPLEX_CST)
913 && TREE_CONSTANT_OVERFLOW (value)
914 && warn_overflow
915 && pedantic)
916 pedwarn ("overflow in constant expression");
917}
918
919/* Print a warning if an expression had overflow in folding.
919/* Print a warning if an expression had overflow in folding and its
920 operands hadn't.
921
920 Invoke this function on every expression that
921 (1) appears in the source code, and
922 Invoke this function on every expression that
923 (1) appears in the source code, and
922 (2) might be a constant expression that overflowed, and
924 (2) is a constant expression that overflowed, and
923 (3) is not already checked by convert_and_check;
925 (3) is not already checked by convert_and_check;
924 however, do not invoke this function on operands of explicit casts. */
926 however, do not invoke this function on operands of explicit casts
927 or when the expression is the result of an operator and any operand
928 already overflowed. */
925
926void
927overflow_warning (tree value)
928{
929
930void
931overflow_warning (tree value)
932{
929 if ((TREE_CODE (value) == INTEGER_CST
930 || (TREE_CODE (value) == COMPLEX_CST
931 && TREE_CODE (TREE_REALPART (value)) == INTEGER_CST))
932 && TREE_OVERFLOW (value))
933 if (skip_evaluation) return;
934
935 switch (TREE_CODE (value))
933 {
936 {
934 TREE_OVERFLOW (value) = 0;
935 if (skip_evaluation == 0)
936 warning (OPT_Woverflow, "integer overflow in expression");
937 case INTEGER_CST:
938 warning (OPT_Woverflow, "integer overflow in expression");
939 break;
940
941 case REAL_CST:
942 warning (OPT_Woverflow, "floating point overflow in expression");
943 break;
944
945 case VECTOR_CST:
946 warning (OPT_Woverflow, "vector overflow in expression");
947 break;
948
949 case COMPLEX_CST:
950 if (TREE_CODE (TREE_REALPART (value)) == INTEGER_CST)
951 warning (OPT_Woverflow, "complex integer overflow in expression");
952 else if (TREE_CODE (TREE_REALPART (value)) == REAL_CST)
953 warning (OPT_Woverflow, "complex floating point overflow in expression");
954 break;
955
956 default:
957 break;
937 }
958 }
938 else if ((TREE_CODE (value) == REAL_CST
939 || (TREE_CODE (value) == COMPLEX_CST
940 && TREE_CODE (TREE_REALPART (value)) == REAL_CST))
941 && TREE_OVERFLOW (value))
942 {
943 TREE_OVERFLOW (value) = 0;
944 if (skip_evaluation == 0)
945 warning (OPT_Woverflow, "floating point overflow in expression");
946 }
947 else if (TREE_CODE (value) == VECTOR_CST && TREE_OVERFLOW (value))
948 {
949 TREE_OVERFLOW (value) = 0;
950 if (skip_evaluation == 0)
951 warning (OPT_Woverflow, "vector overflow in expression");
952 }
953}
954
955/* Print a warning if a large constant is truncated to unsigned,
956 or if -Wconversion is used and a constant < 0 is converted to unsigned.
957 Invoke this function on every expression that might be implicitly
958 converted to an unsigned type. */
959
960static void

--- 5643 unchanged lines hidden ---
959}
960
961/* Print a warning if a large constant is truncated to unsigned,
962 or if -Wconversion is used and a constant < 0 is converted to unsigned.
963 Invoke this function on every expression that might be implicitly
964 converted to an unsigned type. */
965
966static void

--- 5643 unchanged lines hidden ---