This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch fortran] Fix PR 30865
Tobias Burnus schrieb:
> Hi,
>
> Thomas Koenig schrieb:
>
>>> The new test fails for me on x86_64-unknown-linux-gnu at all
>>> optimization levels.
>>>
>>>
>> I don't have a 64-bit system to test this on. Can you send
>> me the -fdump-tree-original file for the test case (or attach
>> it to the PR)?
>>
>>
> I don't think it has anything to do with 64-bit systems. The GIMPLE tree
> looks as follows (it is a bit clearer than the original tree, but they
> are very similar):
>
> D.1402 = *opt1;
> D.1403 = (int8) D.1402;
> D.1378 = &D.1403 != 0B;
> if (D.1378)
>
> The comparison should be "D.1403 != 0B" not "&D.1403 != 0B;". The
> latter is always true.
>
I mean: "opt != 0B" ("D.1403 != 0B" is also wrong).
(I somehow though that was fixed by Richard's commited-as-obvious patch,
but this was a unrelated.)
The following patch produces:
D.1378 = opt1 != 0B;
*ires = D.1378 ? (int4) _gfortran_size1 (D.1377, (int8) *opt1) :
(int4) _gfortran_size0 (D.1377);
Is this patch ok? Build and regression tested on x86_64-unknown-linux-gnu.
Tobias
2007-02-28 Tobias Burnus <burnus@net-b.de>
* trans-intrinsic.c (gfc_conv_intrinsic_size): Compare pointers.
--- gcc/fortran/trans-intrinsic.c (Revision 122401)
+++ gcc/fortran/trans-intrinsic.c (Arbeitskopie)
@@ -2723,10 +2723,13 @@
&& actual->expr->symtree->n.sym->attr.optional)
{
tree tmp;
- tmp = gfc_build_addr_expr (pvoid_type_node,
- argse.expr);
- tmp = build2 (NE_EXPR, boolean_type_node, tmp,
- build_int_cst (pvoid_type_node, 0));
+ gfc_init_se (&argse, NULL);
+ argse.want_pointer = 1;
+ argse.data_not_needed = 1;
+ gfc_conv_expr (&argse, actual->expr);
+ gfc_add_block_to_block (&se->pre, &argse.pre);
+ tmp = build2 (NE_EXPR, boolean_type_node, argse.expr,
+ null_pointer_node);
tmp = gfc_evaluate_now (tmp, &se->pre);
se->expr = build3 (COND_EXPR, pvoid_type_node,
tmp, fncall1, fncall0);