bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/14539] New: ar can't generate correct archive


From: jszhao at yeah dot net
Subject: [Bug binutils/14539] New: ar can't generate correct archive
Date: Sun, 02 Sep 2012 09:05:28 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=14539

             Bug #: 14539
           Summary: ar can't generate correct archive
           Product: binutils
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


Created attachment 6622
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6622
A minimal complete example, source, object, and archive

I am in Windows system using MinGW. Here is a minimal example which can
reproduce the problem.

The source code:

C:\test>type refs_a.f90
module refs_a
   integer, dimension(4) :: refa=(/1,2,3,4/)
   integer, dimension(2,2) :: refb
   equivalence (refa(1), refb(1,1))
end module refs_a

C:\test>type test_a.f90
program test_a
   use refs_a
   write(*,'(4I4)') refa
   write(*,'(4I4)') refb
end program test_a

Then compiled with following step:

gfortran -c refs_a.f90
gfortran -c test_a.f90
ar -r lib_a.a refs_a.o
gfortran test_a.o lib_a.a -o a.exe
gfortran test_a.o refs_a.o -o b.exe

The output of b.exe is correct:
C:\test>b.exe
   1   2   3   4
   1   2   3   4

However, a.exe give:
C:\test>a.exe
   0   0   0   0
   0   0   0   0

So, I think there might be a bug in ar.

The version of gfortran and ar is:

C:\test>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=d:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.0/configure
--enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared
--enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug
--disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.0 (GCC)

C:\test>ar --version
GNU ar (GNU Binutils) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

I also test the above minimal example in a Linux platform. The version of
gfortran and ar is '4.4.6 20110731' and ' 2.17.50.0.6-20.el5_8.3 20061020'.
Both way of compilation gave correct result.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]