public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65419] New: incorrect sibcalls to libgomp functions
@ 2015-03-13 17:52 cesar at gcc dot gnu.org
  2015-03-18 13:45 ` [Bug fortran/65419] " cesar at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: cesar at gcc dot gnu.org @ 2015-03-13 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65419
           Summary: incorrect sibcalls to libgomp functions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: openacc
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cesar at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org

I'm not sure if this problem is fortran specific, but I noticed that gfortran
is identifying calls to libgomp, specifically GOACC_data_end, as a sibcall if a
acc data region is the last statement inside the main function. That's a
problem because GOACC_data_end transfers data from the accelerator to the host
at the end of an acc data region. In the attached test case, the data in
question happens to be allocated on the stack. If you look at the epilogue of
the stack frame

    call    GOACC_data_start
    movq    %rbx, %rsi
    movq    %rsp, %rdi
    call    __field_summary_kernel_module_MOD_field_summary_kernel
    addq    $1296, %rsp
    .cfi_def_cfa_offset 16
    popq    %rbx
    .cfi_def_cfa_offset 8
# SUCC: EXIT [100.0%]  (ABNORMAL,SIBCALL)
    jmp    GOACC_data_end
    .cfi_endproc
.LFE1:

you'll see that %rsp is restored before GOACC_data_end is called. You should be
able to reproduce this bug with "-fopenacc -O2".

Did we specify the built-in declaration for GOACC_data_end wrong, or is this a
fortran specific quirk? I don't mind fixing it, but I'm not even sure what a
sibling call is. I think it has something to do with recursion.

Cesar


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

end of thread, other threads:[~2015-06-02  8:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 17:52 [Bug fortran/65419] New: incorrect sibcalls to libgomp functions cesar at gcc dot gnu.org
2015-03-18 13:45 ` [Bug fortran/65419] " cesar at gcc dot gnu.org
2015-05-27  9:37 ` [Bug tree-optimization/65419] " vries at gcc dot gnu.org
2015-05-27 11:43 ` vries at gcc dot gnu.org
2015-05-27 16:02 ` vries at gcc dot gnu.org
2015-05-27 16:13 ` cesar at gcc dot gnu.org
2015-05-27 16:55 ` vries at gcc dot gnu.org
2015-05-27 17:12 ` jakub at gcc dot gnu.org
2015-05-27 19:05 ` vries at gcc dot gnu.org
2015-05-27 22:00 ` vries at gcc dot gnu.org
2015-05-27 22:06 ` jakub at gcc dot gnu.org
2015-05-28  9:27 ` vries at gcc dot gnu.org
2015-05-28  9:44 ` vries at gcc dot gnu.org
2015-05-28 14:18 ` vries at gcc dot gnu.org
2015-06-02  8:52 ` vries 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).