[LLVMbugs] [Bug 9644] New: Adding dummy argument to Fortran external routines call breaks interop with other languages
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Apr 7 11:12:36 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9644
Summary: Adding dummy argument to Fortran external routines
call breaks interop with other languages
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: maemarcus at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=6407)
--> (http://llvm.org/bugs/attachment.cgi?id=6407)
test case source code
There is an openmpi configure test that writes a Fortran program sending two
sequential pointers of logical type to external function in C. The test is
expected to compute the size of type by difference between two addresses. But
instead of 2 args Fortran part sends 3, starting with 0.
Please see a test case in attachment.
1) Compile:
[dmikushin at tesla-cmc szlogical]$ make
./cgen-gfortran -g -c main.f90
./cgen-gcc -g -c size.c
dragonegg-gfortran main.o size.o -o szlogical
Note cgen-* scripts are implementing the compilation pipeline, looping the llvm
C backend: Source -> emit IR -> llc -> gcc
2) Run debugger:
[dmikushin at tesla-cmc szlogical]$ gdb ./szlogical
(gdb) b size_
Breakpoint 1 at 0x400724: file size.c.bc.c, line 167.
(gdb) r
Starting program:
/home/dmikushin/Programming/kernelgen/tests/public/szlogical/szlogical
Breakpoint 1, size_ (llvm_cbe_a=0x0, llvm_cbe_b=0x7fffffffdf50 "x\v`") at
size.c.bc.c:167
167 llvm_cbe_alloca_20_point = ((unsigned int )0u);
Missing separate debuginfos, use: debuginfo-install glibc-2.13-1.x86_64
libgcc-4.5.1-4.fc14.x86_64 libgfortran-4.5.1-4.fc14.x86_64
(gdb) f 0
#0 size_ (llvm_cbe_a=0x0, llvm_cbe_b=0x7fffffffdf50 "x\v`") at size.c.bc.c:167
167 llvm_cbe_alloca_20_point = ((unsigned int )0u);
(gdb) list
162 unsigned char *llvm_cbe_tmp__1;
163 unsigned char *llvm_cbe_tmp__2;
164 unsigned int llvm_cbe_ssa_20_point;
165 unsigned int llvm_cbe_tmp__3;
166
167 llvm_cbe_alloca_20_point = ((unsigned int )0u);
168 *(&llvm_cbe_a_addr) = llvm_cbe_a;
169 *(&llvm_cbe_b_addr) = llvm_cbe_b;
170 llvm_cbe_tmp__1 = *(&llvm_cbe_b_addr);
171 llvm_cbe_tmp__2 = *(&llvm_cbe_a_addr);
(gdb) f 1
#1 0x0000000000400689 in MAIN__ (vararg_dummy_arg=0) at main.f90.bc.c:172
172 size_(0 /*dummy arg*/, ((&(*(((unsigned int *)(&llvm_cbe_memtmp)))))),
((&(((unsigned int *)(&llvm_cbe_memtmp)))[((signed long long )1ull)])));
(gdb) list
167 unsigned int llvm_cbe_alloca_20_point;
168 unsigned int llvm_cbe_ssa_20_point;
169
170 llvm_cbe_alloca_20_point = ((unsigned int )0u);
171 llvm_cbe_ssa_20_point = ((unsigned int )0u);
172 size_(0 /*dummy arg*/, ((&(*(((unsigned int *)(&llvm_cbe_memtmp)))))),
((&(((unsigned int *)(&llvm_cbe_memtmp)))[((signed long long )1ull)])));
173 return;
174 }
3) The unexpected result: size_ function is called with 3 arguments, while it
actually accepts only 2, and everything gets corrupted.
4) Even simpler single language test has the same problem:
program fsize
external size
logical x(2)
call size(x(1),x(2))
end
subroutine size(X,Y)
end
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list