This is the mail archive of the gcc-patches@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]

Re: [PATCH] remove the unsigned_type language hook


On 5/8/07, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Eric: I know that somebody recently did a gcov run of gnat1 over the entire
> AdaCore test suite and acats.  Can you check if the copy_nodes in the
> code in question are ever executed?

I don't trust this stuff too much. :-)  Instead I put 4 gcc_unreachable () in
the hot spots of gnat_unsigned_type/gnat_signed_type.  It didn't go very far:

../../xgcc -B../../ -B/usr/gnat/i686-pc-linux-gnu/bin/
-isystem /usr/gnat/i686-pc-linux-gnu/include
-isystem /usr/gnat/i686-pc-linux-gnu/sys-include
-L/cardiff.a/gnatmail/gcc-head/build-cardiff/obj/gcc/../ld -c -O2 -fPIC
-gnatpgn  g-alleve.adb -o g-alleve.o
+===========================GNAT BUG DETECTED==============================+
| Pro 6.1.0w (20070507-head) (i686-pc-linux-gnu) GCC error:                |
| in gnat_unsigned_type, at ada/utils.c:2321                               |
| Error detected at g-alleve.adb:1884:59

function To_Pixel (Source : unsigned_short) return Pixel_16 is

      --  This conversion should not depend on the host endianess;
      --  therefore, we cannot use an unchecked conversion.

Target : Pixel_16;

   begin
      Target.T := Unsigned_1 (Bits (Source, 0, 0)   mod 2 ** 1);
      Target.R := Unsigned_5 (Bits (Source, 1, 5)   mod 2 ** 5);
      Target.G := Unsigned_5 (Bits (Source, 6, 10)  mod 2 ** 5);
      Target.B := Unsigned_5 (Bits (Source, 11, 15) mod 2 ** 5);
      return Target;
   end To_Pixel;


Without rebuilding the runtime, ACATS is hurt too:


FAIL:   c354002
FAIL:   c360002
FAIL:   c420001
FAIL:   c450001
FAIL:   c460008
FAIL:   c460011
FAIL:   cxf2a01
FAIL:   cxf2a02


However, like Richard G, I don't fully understand the purpose of the code. Do you have any recollections?

Something that would make more "sense" would be that the generic code substituted for this langhook has to handle the case that we ask for an unsigned variant of a subtype by making sure to make the unsigned subtype a subtype of the unsigned variant of the original basetype. So (pseudocode)

 if (TREE_TYPE (type))
   TREE_TYPE (new_type) = unsigned_type_for (TREE_TYPE(type));

Richard.


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