Bug 33376 - [4.3 regression] USE with renaming, assembler message: symbol already defined
Summary: [4.3 regression] USE with renaming, assembler message: symbol already defined
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Paul Thomas
URL:
Keywords: link-failure
Depends on:
Blocks:
 
Reported: 2007-09-10 09:05 UTC by Harald Anlauf
Modified: 2007-09-22 16:40 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-09-21 17:18:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Anlauf 2007-09-10 09:05:34 UTC
Hi,

the following program fails to compile with rev.128283
but used to work just a few days ago:

% cat gfcbug70.f90
module foo
  implicit none
  public chk

  type mytype
    character(len=4) :: str
  end type mytype
  type (mytype) ,parameter :: chk (1) = (/ mytype ("abcd") /)
end module foo

module gfcbug70
  use foo, only: chk_ => chk
  implicit none
contains

  subroutine chk (i)
    integer, intent(in) :: i

    print *, chk_(i)% str
  end subroutine chk
end module gfcbug70

I get:

/tmp/ccnnONGa.s: Assembler messages:
/tmp/ccnnONGa.s:19: Error: symbol `__gfcbug70_MOD_chk' is already defined
Comment 1 Tobias Burnus 2007-09-10 11:36:44 UTC
Works:
  gcc version 4.3.0 20070905 (experimental) [trunk revision 128123] (GCC)
Fails:
  gcc version 4.3.0 20070906 (experimental) [trunk revision 128175] (GCC)
Comment 2 Tobias Burnus 2007-09-10 14:08:05 UTC
The regression is caused by
http://gcc.gnu.org/ml/gcc-cvs/2007-09/msg00124.html

2007-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31564 (PR31564)
	* primary.c (gfc_match_rvalue): Make expressions that refer
	to derived type parameters that have array references into
	variable expressions.  Remove references to use association
	from the symbol.

	PR fortran/33241 (PR33241)
	* decl.c (add_init_expr_to_sym): Provide assumed character
	length parameters with the length of the initialization
	expression, if a constant, or that of the first element of
	an array.
Comment 3 Paul Thomas 2007-09-21 16:48:27 UTC
Hi Harald!

The number of your testcase is depressing but I'll take it on anyway; it's related to PR33337, as well as PR31564, whose patch caused this regression.

There is some wierdness going on with name-mangling that I am sure is the cause.

Cheers

Paul
Comment 4 Paul Thomas 2007-09-21 17:18:04 UTC
It's mine.

Paul
Comment 5 Paul Thomas 2007-09-22 09:32:35 UTC
(In reply to comment #4)
> It's mine.
> 
> Paul
> 
The patch has been posted on the list.

http://gcc.gnu.org/ml/fortran/2007-09/msg00378.html

Paul
Comment 6 Paul Thomas 2007-09-22 15:46:56 UTC
Subject: Bug 33376

Author: pault
Date: Sat Sep 22 15:46:41 2007
New Revision: 128672

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128672
Log:
2007-09-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/33337
	PR fortran/33376
	* trans-decl.c (gfc_create_module_variable): Output
	derived type parameters.
	* arith.c (gfc_parentheses): Return the argument if
	it is a constant expression.
	* primary.c (gfc_match_rvalue): Remove the clearing of
	the module name and the use_assoc attribute for derived
	type parameter expressions.

2007-09-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/33337
	* gfortran.dg/derived_comp_array_ref_3.f90: New test.

	PR fortran/33376
	* gfortran.dg/derived_comp_array_ref_4.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_3.f90
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/arith.c
    trunk/gcc/fortran/primary.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Paul Thomas 2007-09-22 16:40:10 UTC
Fixed on trunk.

Thanks, Harald.

Paul