Commit 5291e69a by Paul Brook Committed by Paul Brook

gfortran.h (struct gfc_symbol): Add equiv_built.

	* gfortran.h (struct gfc_symbol): Add equiv_built.
	* trans-common.c: Change int to HOST_WIDE_INT.  Capitalize error
	messages.
	(current_length): Remove.
	(add_segments): New function.
	(build_equiv_decl): Create initialized common blocks.
	(build_common_decl): Always add decl to bindings.
	(create_common): Create initializers.
	(find_segment_info): Reformat to match coding conventions.
	(new_condition): Use add_segments.
	(add_condition, find_equivalence, add_equivalences): Move iteration
	inside functions.  Only process each segment once.
	(new_segment, finish_equivalences, translate_common): Simplify.
testsuite/
	* gfortran.fortran-torture/execute/common_init_1.f90: New test.
	* gfortran.fortran-torture/execute/equiv_init.f90: New test.

Co-Authored-By: Victor Leikehman <lei@haifasphere.co.il>

From-SVN: r82165
parent 68ca1923
2004-05-23 Paul Brook <paul@codesourcery.com>
Victor Leikehman <lei@haifasphere.co.il>
* gfortran.h (struct gfc_symbol): Add equiv_built.
* trans-common.c: Change int to HOST_WIDE_INT. Capitalize error
messages.
(current_length): Remove.
(add_segments): New function.
(build_equiv_decl): Create initialized common blocks.
(build_common_decl): Always add decl to bindings.
(create_common): Create initializers.
(find_segment_info): Reformat to match coding conventions.
(new_condition): Use add_segments.
(add_condition, find_equivalence, add_equivalences): Move iteration
inside functions. Only process each segment once.
(new_segment, finish_equivalences, translate_common): Simplify.
2004-05-23 Steven G. Kargl <kargls@comcast.net> 2004-05-23 Steven G. Kargl <kargls@comcast.net>
* check.c (gfc_check_random_seed): Issue for too many arguments. * check.c (gfc_check_random_seed): Issue for too many arguments.
......
...@@ -651,6 +651,9 @@ typedef struct gfc_symbol ...@@ -651,6 +651,9 @@ typedef struct gfc_symbol
struct gfc_symbol *old_symbol, *tlink; struct gfc_symbol *old_symbol, *tlink;
unsigned mark:1, new:1; unsigned mark:1, new:1;
/* Nonzero if all equivalences associated with this symbol have been
processed. */
unsigned equiv_built:1;
int refs; int refs;
struct gfc_namespace *ns; /* namespace containing this symbol */ struct gfc_namespace *ns; /* namespace containing this symbol */
......
2004-05-23 Paul Brook <paul@codesourcery.com>
Victor Leikehman <lei@haifasphere.co.il>
* gfortran.fortran-torture/execute/common_init_1.f90: New test.
* gfortran.fortran-torture/execute/equiv_init.f90: New test.
2004-05-22 Mark Mitchell <mark@codesourcery.com> 2004-05-22 Mark Mitchell <mark@codesourcery.com>
PR c++/15285 PR c++/15285
......
! Program to test initialization of common blocks.
subroutine test()
character(len=15) :: c
integer d, e
real f
common /block2/ c
common /block/ d, e, f
if ((d .ne. 42) .or. (e .ne. 43) .or. (f .ne. 2.0)) call abort ()
if (c .ne. "Hello World ") call abort ()
end subroutine
program prog
integer a(2)
real b
character(len=15) :: s
common /block/ a, b
common /block2/ s
data b, a/2.0, 42, 43/
data s /"Hello World"/
call test ()
end program
! Program to test initialization of equivalence blocks. PR13742.
! Some forms are not yet implemented. These are indicated by !!$
subroutine test0s
character*10 :: x = "abcdefghij"
character*10 :: y
equivalence (x,y)
character*10 :: xs(10)
character*10 :: ys(10)
equivalence (xs,ys)
data xs /10*"abcdefghij"/
if (y.ne."abcdefghij") call abort
if (ys(1).ne."abcdefghij") call abort
if (ys(10).ne."abcdefghij") call abort
end
subroutine test0
integer :: x = 123
integer :: y
equivalence (x,y)
if (y.ne.123) call abort
end
subroutine test1
integer :: a(3)
integer :: x = 1
integer :: y
integer :: z = 3
equivalence (a(1), x)
equivalence (a(3), z)
if (x.ne.1) call abort
if (z.ne.3) call abort
if (a(1).ne.1) call abort
if (a(3).ne.3) call abort
end
subroutine test2
integer :: x
integer :: z
integer :: a(3) = 123
equivalence (a(1), x)
equivalence (a(3), z)
if (x.ne.123) call abort
if (z.ne.123) call abort
end
subroutine test3
integer :: x
!!$ integer :: y = 2
integer :: z
integer :: a(3)
equivalence (a(1),x), (a(2),y), (a(3),z)
data a(1) /1/, a(3) /3/
if (x.ne.1) call abort
!!$ if (y.ne.2) call abort
if (z.ne.3) call abort
end
subroutine test4
integer a(2)
integer b(2)
integer c
equivalence (a(2),b(1)), (b(2),c)
data a/1,2/
data c/3/
if (b(1).ne.2) call abort
if (b(2).ne.3) call abort
end
!!$subroutine test5
!!$ integer a(2)
!!$ integer b(2)
!!$ integer c
!!$ equivalence (a(2),b(1)), (b(2),c)
!!$ data a(1)/1/
!!$ data b(1)/2/
!!$ data c/3/
!!$ if (a(2).ne.2) call abort
!!$ if (b(2).ne.3) call abort
!!$ print *, "Passed test5"
!!$end
program main
call test0s
call test0
call test1
call test2
call test3
call test4
!!$ call test5
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment