Found in testing.  Committed to trunk.

Dave
---

hppa: Fix read_only_operand handling for non-HP-UX targets

The read_only_operand predicate currently assumes that the constant pool
is placed in the TEXT section when flag_pic is false, which is specific
to 32-bit HP-UX. Non-HP-UX targets (such as pa-linux) do not share
this property.

This patch updates the predicate to check for !TARGET_HPUX, ensuring
that the correct constant pool logic applies across both HP-UX and
non-HP-UX PA-RISC targets.

2026-11-10  John David Anglin  <[email protected]>

gcc/ChangeLog:

        * config/pa/predicates.md (read_only_operand): Check !TARGET_HPUX
        when considering CONSTANT_POOL_ADDRESS_P for SYMBOL_REF.

diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index 9ff450daa76..70ac7f55701 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -527,7 +527,8 @@
     op = XEXP (XEXP (op, 0), 0);
   if (GET_CODE (op) == SYMBOL_REF)
     {
-      if (flag_pic)
+      /* 32-bit HP-UX has constant pool in TEXT section.  */
+      if (flag_pic || !TARGET_HPUX)
         return SYMBOL_REF_FLAG (op) && !CONSTANT_POOL_ADDRESS_P (op);
       else
         return SYMBOL_REF_FLAG (op) || CONSTANT_POOL_ADDRESS_P (op);

Attachment: signature.asc
Description: PGP signature

Reply via email to