This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/24599] [4.0 regression] segv after overflow detection



------- Comment #5 from rakdver at gcc dot gnu dot org  2005-11-04 14:02 -------
This happens in c-typeck.c:build_c_cast:

      value = convert (type, value);

      /* Ignore any integer overflow caused by the cast.  */
      if (TREE_CODE (value) == INTEGER_CST)
        {
          /* If OVALUE had overflow set, then so will VALUE, so it
             is safe to overwrite.  */
          if (CONSTANT_CLASS_P (ovalue))
            {
              TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
              /* Similarly, constant_overflow cannot have become cleared.  */
              TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
            }

build_c_cast assumes that convert will not return non-overflowed constant if it
received an overflowed one.  This however is not true, since
convert (boolean_type_node, ...) will sometimes return shared
boolean_{true,false}_node constants.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]