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 middle-end/81931] [8 regression] r251260 breaks many tests on powerpc64


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81931

--- Comment #9 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)

> I suppose the idea was to make nonzero_bits foolproof.  And -1 being
> sign-extended should be fine... unless precision is 0 ;)
> 
> So, in nonzero_bits use TYPE_PRECISION only for INTEGRAL_TYPE_P and
> POINTER_TYPE_P but for other types use TYPE_SIZE (or some arbitrary
> nonzero precision?  BITS_PER_UNIT?).

Fixes testcase.  Untested otherwise.

diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 676c806..04a30b8 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -470,7 +470,7 @@ get_nonzero_bits (const_tree name)
   if (TREE_CODE (name) == INTEGER_CST)
     return name;

-  unsigned int precision = TYPE_PRECISION (TREE_TYPE (name));
+  unsigned int precision = element_precision (TREE_TYPE (name));
   if (POINTER_TYPE_P (TREE_TYPE (name)))
     {
       struct ptr_info_def *pi = SSA_NAME_PTR_INFO (name);

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