This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix minor bug in VIEW_CONVERT_EXPR expander
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Apr 2010 18:28:37 +0200
- Subject: Re: Fix minor bug in VIEW_CONVERT_EXPR expander
- References: <201004231817.09784.ebotcazou@adacore.com>
On Fri, Apr 23, 2010 at 6:17 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> There is a minor bug in the VIEW_CONVERT_EXPR expander in the 4.x series of
> compilers, visible mostly on big-endian platforms:
>
> ? ? ?/* If both modes are integral, then we can convert from one to the
> ? ? ? ? other. ?*/
> ? ? ?else if (SCALAR_INT_MODE_P (GET_MODE (op0)) && SCALAR_INT_MODE_P (mode))
> ? ? ? ?op0 = convert_modes (mode, GET_MODE (op0), op0,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE_UNSIGNED (TREE_TYPE (treeop0)));
>
> Integral mode doesn't imply integral type, the type can be a small record or
> array, in which case the TYPE_UNSIGNED test doesn't make sense and the result
> is wrong on big-endian platforms.
Hm, but both modes should have the same size and thus both
modes shall be always equal.
Or we come here with invalid VIEW_CONVERT_EXPRs.
What am I missing?
Thanks,
Richard.
> Fixed thusly, tested on x86_64-suse-linux and SPARC/Solaris, applied on the
> mainline as obvious.
>
>
> 2010-04-23 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Only use conversion
> ? ? ? ?between modes if both types are integral.
>
>
> 2010-04-23 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* gnat.dg/unchecked_convert5.adb: New test.
>
>
> --
> Eric Botcazou
>