public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads
@ 2015-03-24 13:45 rainer@emrich-ebersheim.de
  2015-03-28 14:23 ` [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2 ebotcazou at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: rainer@emrich-ebersheim.de @ 2015-03-24 13:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

            Bug ID: 65540
           Summary: [5 Regression] GNAT BUG in s-fatllf.ads
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rainer@emrich-ebersheim.de

Created attachment 35125
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35125&action=edit
ada sources

That's a regression in gcc 5. Used to work at least until end of October last
year. Looks like an issue in s-fatgen.adb which was last changed in January.

/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/./gcc/xgcc
-B/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/./gcc/
-L/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/lib
-L/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/mingw/lib
-isystem
/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/include
-isystem
/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/mingw/include
-B/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/bin/
-B/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/lib/
-isystem
/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/include
-isystem
/opt/devel/gnu/gcc/MINGW_NT/x86_64-w64-mingw32/mingw-w64-runtime-trunk-svn/gcc-5.0.0/x86_64-w64-mingw32/sys-include
   -c -g -O2    -W -Wall -gnatpg -nostdinc   s-fatllf.ads -o s-fatllf.o
+===========================GNAT BUG DETECTED==============================+
| 5.0.0 20150323 (experimental) [trunk revision 221607] (x86_64-w64-mingw32)
GCC error:|
| in expand_expr_addr_expr_1, at expr.c:7761                               |
| Error detected around s-fatgen.adb:363:4                                 |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

system.ads
s-fatllf.ads
s-fatgen.ads
s-fatgen.adb
ada.ads
a-unccon.ads
s-unstyp.ads


raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:423
../gcc-interface/Makefile:311: recipe for target 's-fatllf.o' failed
make[6]: *** [s-fatllf.o] Error 1
make[6]: Leaving directory
'/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/gcc/ada/rts'
gcc-interface/Makefile:2730: recipe for target 'gnatlib' failed
make[5]: *** [gnatlib] Error 2
make[5]: Leaving directory
'/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/gcc/ada'
gcc-interface/Makefile:2838: recipe for target 'gnatlib-shared-win32' failed
make[4]: *** [gnatlib-shared-win32] Error 2
make[4]: Leaving directory
'/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/gcc/ada'
gcc-interface/Makefile:2891: recipe for target 'gnatlib-shared' failed
make[3]: *** [gnatlib-shared] Error 2
make[3]: Leaving directory
'/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/gcc/ada'
Makefile:113: recipe for target 'gnatlib-shared' failed
make[2]: *** [gnatlib-shared] Error 2
make[2]: Leaving directory
'/opt/devel/SCRATCH/tmp.yzRIgp5nEc/gcc-5.0.0/gcc-5.0.0/x86_64-w64-mingw32/libada'
Makefile:18738: recipe for target 'all-target-libada' failed


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
@ 2015-03-28 14:23 ` ebotcazou at gcc dot gnu.org
  2015-03-28 14:26 ` ebotcazou at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-28 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-28
                 CC|                            |ebotcazou at gcc dot gnu.org
               Host|x86_64-w64-mingw32          |
   Target Milestone|---                         |5.0
            Summary|[5 Regression] GNAT BUG in  |[5 Regression] internal
                   |s-fatllf.ads                |error on s-fatllf.ads at
                   |                            |-O2
     Ever confirmed|0                           |1
              Build|x86_64-w64-mingw32          |

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Confirmed with -O2 (but works with -O1).


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
  2015-03-28 14:23 ` [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2 ebotcazou at gcc dot gnu.org
@ 2015-03-28 14:26 ` ebotcazou at gcc dot gnu.org
  2015-03-30 14:55 ` [Bug ipa/65540] " ebotcazou at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-28 14:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Investigating.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
  2015-03-28 14:23 ` [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2 ebotcazou at gcc dot gnu.org
  2015-03-28 14:26 ` ebotcazou at gcc dot gnu.org
@ 2015-03-30 14:55 ` ebotcazou at gcc dot gnu.org
  2015-03-31  8:30 ` ebotcazou at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-30 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ada                         |ipa

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
It's ICF folding Machine_Rounding into Rounding:

System.Fat_Llf.Attr_Long_Long_Float.Machine_Rounding (const
system__fat_llf__attr_long_long_float__t x)
{
  system__fat_llf__attr_long_long_float__t retval.8;

  <bb 2>:
  retval.8_2 = system.fat_llf.attr_long_long_float.rounding (x_1(D)); [return
slot optimization] [tail call]
  return retval.8_2;
}

and apparently messing up the call statement.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (2 preceding siblings ...)
  2015-03-30 14:55 ` [Bug ipa/65540] " ebotcazou at gcc dot gnu.org
@ 2015-03-31  8:30 ` ebotcazou at gcc dot gnu.org
  2015-03-31  8:31 ` ebotcazou at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-31  8:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #35125|0                           |1
        is obsolete|                            |

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Created attachment 35189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35189&action=edit
reduced C testcase

To be compiled at -O2.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (3 preceding siblings ...)
  2015-03-31  8:30 ` ebotcazou at gcc dot gnu.org
@ 2015-03-31  8:31 ` ebotcazou at gcc dot gnu.org
  2015-03-31 13:11 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-31  8:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|ebotcazou at gcc dot gnu.org       |unassigned at gcc dot gnu.org

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Something goes wrong during the creation of the thunk, probably because the
type is both a scalar type and returned by reference in the 64-bit MS ABI.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (4 preceding siblings ...)
  2015-03-31  8:31 ` ebotcazou at gcc dot gnu.org
@ 2015-03-31 13:11 ` rguenth at gcc dot gnu.org
  2015-03-31 16:07 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-31 13:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (5 preceding siblings ...)
  2015-03-31 13:11 ` rguenth at gcc dot gnu.org
@ 2015-03-31 16:07 ` marxin at gcc dot gnu.org
  2015-03-31 16:22 ` ebotcazou at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-03-31 16:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Without having a Windows machine, what is the easiest way to reproduced the
problem? Can I reproduce the problem with cross compiler?

Thanks,
Martin
>From gcc-bugs-return-482406-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 31 15:58:49 2015
Return-Path: <gcc-bugs-return-482406-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10674 invoked by alias); 31 Mar 2015 15:58:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10620 invoked by uid 48); 31 Mar 2015 15:58:45 -0000
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/65549] [5 Regression] crash in htab_hash_string with -flto -g
Date: Tue, 31 Mar 2015 16:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: debug
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: lto
X-Bugzilla-Severity: normal
X-Bugzilla-Who: trippels at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65549-4-w7EgQjSnqz@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65549-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65549-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg03550.txt.bz2
Content-length: 192

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide549

--- Comment #15 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
It really started with r219076 aka ipa-inline sreal conversion.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (6 preceding siblings ...)
  2015-03-31 16:07 ` marxin at gcc dot gnu.org
@ 2015-03-31 16:22 ` ebotcazou at gcc dot gnu.org
  2015-04-01  2:58 ` hubicka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-03-31 16:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Without having a Windows machine, what is the easiest way to reproduced the
> problem? Can I reproduce the problem with cross compiler?

Yes, configure for the target indicated in the field above.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (7 preceding siblings ...)
  2015-03-31 16:22 ` ebotcazou at gcc dot gnu.org
@ 2015-04-01  2:58 ` hubicka at gcc dot gnu.org
  2015-04-01  3:29 ` hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-01  2:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK,
hand written wrapper is produced as follows:
f3 (long double x)
{
  long double _3;

  <bb 2>:
  _3 = func2 (x_2(D)); [return slot optimization]
  <retval> = _3;
  return <retval>;

}

and create_wrapper produces:

func1 (long double x)
{
  long double retval.3;

  <bb 2>:
  retval.3_2 = func2 (x_1(D)); [return slot optimization] [tail call]
  return retval.3_2;

}

I suppose it is the tail call that fails here, but I think it is just missed
optimization we do not produce it in the first case because the parameter also
needs copying:
f3:
        subq    $72, %rsp
        .seh_stackalloc 72
        .seh_endprologue
        fldt    (%rdx)
        movq    %rcx, %r8
        leaq    32(%rsp), %rdx
        leaq    48(%rsp), %rcx
        fstpt   32(%rsp)
        call    func2
        movq    %r8, %rax
        fldt    48(%rsp)
        fstpt   (%r8)
        addq    $72, %rsp
        ret

compiling it as jmp func2 would definitly be an improvmeent!

We die expanding address of the first parameter:
#2  0x00000000104f6d5c in expand_expr_addr_expr_1 (exp=0x3fffaf921050,
target=target@entry=0x0, tmode=tmode@entry=DImode,
modifier=modifier@entry=EXPAND_NORMAL, as=as@entry=0 '\000')
    at ../../gcc/expr.c:7761
7761      gcc_assert (inner != exp);
(gdb) p debug_tree (exp)
 <ssa_name 0x3fffaf921050
    type <real_type 0x3fffaf8c1500 long double XF
        size <integer_cst 0x3fffaf880cf0 constant 128>
        unit size <integer_cst 0x3fffaf880d08 constant 16>
        align 128 symtab 0 alias set 1 canonical type 0x3fffaf8c1500 precision
80
        pointer_to_this <pointer_type 0x3fffaf8c16f8>>
    visited var <parm_decl 0x3fffafa80000 x>def_stmt GIMPLE_NOP

    version 1>
$1 = void

Where clearly we have problem of copying it to SSA name.

I suppose code in https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00423.html may
need to happen on non-aggregates, too


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (8 preceding siblings ...)
  2015-04-01  2:58 ` hubicka at gcc dot gnu.org
@ 2015-04-01  3:29 ` hubicka at gcc dot gnu.org
  2015-04-02 16:31 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-01  3:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, this patch extends the calls.c hack:
Index: calls.c
===================================================================
--- calls.c     (revision 221805)
+++ calls.c     (working copy)
@@ -1321,6 +1321,15 @@ initialize_argument_information (int num
                  && TREE_CODE (base) != SSA_NAME
                  && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
            {
+             /* We may have turned the parameter value into an SSA name.
+                Go back to the original parameter so we can take the
+                address.  */
+             if (TREE_CODE (args[i].tree_value) == SSA_NAME)
+               {
+                 gcc_assert (SSA_NAME_IS_DEFAULT_DEF (args[i].tree_value));
+                 args[i].tree_value = SSA_NAME_VAR (args[i].tree_value);
+                 gcc_assert (TREE_CODE (args[i].tree_value) == PARM_DECL);
+               }
              /* Argument setup code may have copied the value to register.  We
                 revert that optimization now because the tail call code must
                 use the original location.  */

We fail to produce tail call, because the logic checking return values
triggers. At least save the extra copy of parameter:
func1:
        subq    $56, %rsp
        .seh_stackalloc 56
        .seh_endprologue
        movq    %rcx, %r8
        leaq    32(%rsp), %rcx
        call    func2
        fldt    32(%rsp)
        movq    %r8, %rax
        fstpt   (%r8)
        addq    $56, %rsp
        ret
        .seh_endproc
        .section        .text.unlikely,"x"

I will regtest&bootstrap this on ppc but it would be nice if someone could
verify the generated code works (it seems RDX is holding the parameter pointer
and RCX the temporary slot).

Making this tail call seem to need more work, because the link to the actual
return address is lost much earlier:

#0  initialize_argument_information (num_actuals=2, args=0x3fffffffdb80,
args_size=0x3fffffffdf68, n_named_args=3, exp=0x3fffaf9415e0,
struct_value_addr_value=0x3fffaf9518c0, 
    fndecl=0x3fffafa5e580, fntype=0x3fffaf8c5898, args_so_far=...,
reg_parm_stack_space=32, old_stack_level=0x3fffffffdfb0,
old_pending_adj=0x3fffffffdfb8, 
    must_preallocate=0x3fffffffdf9c, ecf_flags=0x3fffffffdfa0,
may_tailcall=0x3fffffffdf60, call_from_thunk_p=true) at ../../gcc/calls.c:1343
#1  0x000000001038abfc in expand_call (exp=0x3fffaf9415e0, target=0x0,
ignore=0) at ../../gcc/calls.c:2695
#2  0x00000000104f0980 in expand_expr_real_1 (exp=exp@entry=0x3fffaf9415e0,
target=<optimized out>, tmode=<optimized out>, modifier=<optimized out>,
alt_rtl=0x3fffffffe308, 
    inner_reference_p=<optimized out>) at ../../gcc/expr.c:10492
#3  0x00000000104f50b0 in expand_expr_real (exp=exp@entry=0x3fffaf9415e0,
target=<optimized out>, tmode=<optimized out>,
modifier=modifier@entry=EXPAND_NORMAL, 
    alt_rtl=alt_rtl@entry=0x3fffffffe308,
inner_reference_p=inner_reference_p@entry=false) at ../../gcc/expr.c:8018
#4  0x00000000104ff7f0 in store_expr_with_bounds (exp=exp@entry=0x3fffaf9415e0,
target=target@entry=0x3fffaf88c5e8, call_param_p=call_param_p@entry=0, 
    nontemporal=nontemporal@entry=false, btarget=btarget@entry=0x3fffaf920ee8)
at ../../gcc/expr.c:5385
#5  0x0000000010502188 in expand_assignment (to=0x3fffaf920ee8,
from=0x3fffaf9415e0, nontemporal=<optimized out>) at ../../gcc/expr.c:5154

already in expand assignment to is set as follows:
 <ssa_name 0x3fffaf920ee8
    type <real_type 0x3fffaf8c1500 long double XF
        size <integer_cst 0x3fffaf880cf0 constant 128>
        unit size <integer_cst 0x3fffaf880d08 constant 16>
        align 128 symtab 0 alias set 1 canonical type 0x3fffaf8c1500 precision
80
        pointer_to_this <pointer_type 0x3fffaf8c16f8>>
    visited var <var_decl 0x3fffaf9514d0 retval.2>def_stmt retval.2_2 = func2
(x_1(D)); [return slot optimization] [tail call]

    version 2>

and retval is temporary produced by expand_thunk.  I suppose expand_thunk must
not do the temporary in this case.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (9 preceding siblings ...)
  2015-04-01  3:29 ` hubicka at gcc dot gnu.org
@ 2015-04-02 16:31 ` hubicka at gcc dot gnu.org
  2015-04-07 14:22 ` steven at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-02 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Patch posted at https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00003.html


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (10 preceding siblings ...)
  2015-04-02 16:31 ` hubicka at gcc dot gnu.org
@ 2015-04-07 14:22 ` steven at gcc dot gnu.org
  2015-04-07 21:02 ` hubicka at gcc dot gnu.org
  2015-04-07 21:02 ` hubicka at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu.org @ 2015-04-07 14:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (12 preceding siblings ...)
  2015-04-07 21:02 ` hubicka at gcc dot gnu.org
@ 2015-04-07 21:02 ` hubicka at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-07 21:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Tue Apr  7 21:02:12 2015
New Revision: 221910

URL: https://gcc.gnu.org/viewcvs?rev=221910&root=gcc&view=rev
Log:
     PR ipa/65540
    * calls.c (initialize_argument_information): When producing tail
    call also turn SSA_NAMES passed by references to original PARM_DECLs
    * gcc.c-torture/compile/pr65540.c: New.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr65540.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug ipa/65540] [5 Regression] internal error on s-fatllf.ads at -O2
  2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
                   ` (11 preceding siblings ...)
  2015-04-07 14:22 ` steven at gcc dot gnu.org
@ 2015-04-07 21:02 ` hubicka at gcc dot gnu.org
  2015-04-07 21:02 ` hubicka at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-07 21:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65540

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #13 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-04-07 21:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 13:45 [Bug ada/65540] New: [5 Regression] GNAT BUG in s-fatllf.ads rainer@emrich-ebersheim.de
2015-03-28 14:23 ` [Bug ada/65540] [5 Regression] internal error on s-fatllf.ads at -O2 ebotcazou at gcc dot gnu.org
2015-03-28 14:26 ` ebotcazou at gcc dot gnu.org
2015-03-30 14:55 ` [Bug ipa/65540] " ebotcazou at gcc dot gnu.org
2015-03-31  8:30 ` ebotcazou at gcc dot gnu.org
2015-03-31  8:31 ` ebotcazou at gcc dot gnu.org
2015-03-31 13:11 ` rguenth at gcc dot gnu.org
2015-03-31 16:07 ` marxin at gcc dot gnu.org
2015-03-31 16:22 ` ebotcazou at gcc dot gnu.org
2015-04-01  2:58 ` hubicka at gcc dot gnu.org
2015-04-01  3:29 ` hubicka at gcc dot gnu.org
2015-04-02 16:31 ` hubicka at gcc dot gnu.org
2015-04-07 14:22 ` steven at gcc dot gnu.org
2015-04-07 21:02 ` hubicka at gcc dot gnu.org
2015-04-07 21:02 ` hubicka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).