]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Handle fixed-point types in amd64_classify
authorTom Tromey <tromey@adacore.com>
Tue, 10 Feb 2026 14:47:42 +0000 (07:47 -0700)
committerTom Tromey <tromey@adacore.com>
Fri, 13 Feb 2026 20:37:41 +0000 (13:37 -0700)
gdb.ada/fixed_points_function.exp was failing when compiled with
gnat-llvm.  Debugging showed that this was a gdb bug that was hidden
by differences in the DWARF generated by gcc and gnat-llvm.

In particular, gcc emitted a DW_TAG_subrange_type (a subrange of the
fixed-point type) for the function's parameter type, whereas gnat-llvm
used a fixed-point type directly.

Then, the test failed because amd64_classify recognizes subrange types
but not fixed-point types.  Under the hood, fixed-point types are
really just integers, so the fix is to handle these directly in
amd64_classify.

Approved-By: Christina Schimpe <christina.schimpe@intel.com>
gdb/amd64-tdep.c

index ff2e9dee117d2449945349a7e3ed0d397479c94a..1334ce6fb07c2bb2f4987457523a7d42d6dde6a2 100755 (executable)
@@ -693,11 +693,12 @@ amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
 
   /* Arguments of types (signed and unsigned) _Bool, char, short, int,
      long, long long, and pointers are in the INTEGER class.  Similarly,
-     range types, used by languages such as Ada, are also in the INTEGER
-     class.  */
+     range and fixed-point types, used by languages such as Ada, are
+     also in the INTEGER class.  This comes form the System V ABI
+     (section 3.2.3, Parameter Passing).  */
   if ((code == TYPE_CODE_INT || code == TYPE_CODE_ENUM
        || code == TYPE_CODE_BOOL || code == TYPE_CODE_RANGE
-       || code == TYPE_CODE_CHAR
+       || code == TYPE_CODE_CHAR || code == TYPE_CODE_FIXED_POINT
        || code == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
       && (len == 1 || len == 2 || len == 4 || len == 8))
     theclass[0] = AMD64_INTEGER;