Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7067f8c8
Commit
7067f8c8
authored
Mar 01, 2020
by
Paul Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch for PR92959
parent
63cc547f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
12 deletions
+46
-12
gcc/fortran/trans-intrinsic.c
+9
-12
gcc/testsuite/gfortran.dg/associated_8.f90
+37
-0
No files found.
gcc/fortran/trans-intrinsic.c
View file @
7067f8c8
...
@@ -8573,7 +8573,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
...
@@ -8573,7 +8573,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
gfc_se
arg2se
;
gfc_se
arg2se
;
tree
tmp2
;
tree
tmp2
;
tree
tmp
;
tree
tmp
;
tree
nonzero_charlen
;
tree
nonzero_arraylen
;
tree
nonzero_arraylen
;
gfc_ss
*
ss
;
gfc_ss
*
ss
;
bool
scalar
;
bool
scalar
;
...
@@ -8629,13 +8628,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
...
@@ -8629,13 +8628,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
if
(
arg2
->
expr
->
ts
.
type
==
BT_CLASS
)
if
(
arg2
->
expr
->
ts
.
type
==
BT_CLASS
)
gfc_add_data_component
(
arg2
->
expr
);
gfc_add_data_component
(
arg2
->
expr
);
nonzero_charlen
=
NULL_TREE
;
if
(
arg1
->
expr
->
ts
.
type
==
BT_CHARACTER
)
nonzero_charlen
=
fold_build2_loc
(
input_location
,
NE_EXPR
,
logical_type_node
,
arg1
->
expr
->
ts
.
u
.
cl
->
backend_decl
,
build_zero_cst
(
TREE_TYPE
(
arg1
->
expr
->
ts
.
u
.
cl
->
backend_decl
)));
if
(
scalar
)
if
(
scalar
)
{
{
/* A pointer to a scalar. */
/* A pointer to a scalar. */
...
@@ -8705,10 +8697,15 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
...
@@ -8705,10 +8697,15 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
/* If target is present zero character length pointers cannot
/* If target is present zero character length pointers cannot
be associated. */
be associated. */
if
(
nonzero_charlen
!=
NULL_TREE
)
if
(
arg1
->
expr
->
ts
.
type
==
BT_CHARACTER
)
se
->
expr
=
fold_build2_loc
(
input_location
,
TRUTH_AND_EXPR
,
{
logical_type_node
,
tmp
=
arg1se
.
string_length
;
se
->
expr
,
nonzero_charlen
);
tmp
=
fold_build2_loc
(
input_location
,
NE_EXPR
,
logical_type_node
,
tmp
,
build_zero_cst
(
TREE_TYPE
(
tmp
)));
se
->
expr
=
fold_build2_loc
(
input_location
,
TRUTH_AND_EXPR
,
logical_type_node
,
se
->
expr
,
tmp
);
}
}
}
se
->
expr
=
convert
(
gfc_typenode_for_spec
(
&
expr
->
ts
),
se
->
expr
);
se
->
expr
=
convert
(
gfc_typenode_for_spec
(
&
expr
->
ts
),
se
->
expr
);
...
...
gcc/testsuite/gfortran.dg/associated_8.f90
0 → 100644
View file @
7067f8c8
! { dg-do run }
!
! Test the fix for PR92959, where compilation of ASSOCIATED segfaulted in 's1' and 's2'.
!
! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
!
program
p
character
(:),
pointer
::
x
,
y
=>
NULL
()
character
,
pointer
::
u
,
v
=>
NULL
()
character
(
4
),
target
::
tgt
=
"abcd"
! Manifestly not associated
x
=>
tgt
u
=>
tgt
(
1
:
1
)
call
s1
(
.false.
,
1
)
call
s2
(
.false.
,
2
)
! Manifestly associated
y
=>
x
v
=>
u
call
s1
(
.true.
,
3
)
call
s2
(
.true.
,
4
)
! Zero sized storage sequences must give a false.
y
=>
tgt
(
1
:
0
)
x
=>
y
call
s1
(
.false.
,
5
)
contains
subroutine
s1
(
state
,
err_no
)
logical
::
state
integer
::
err_no
if
(
associated
(
x
,
y
)
.neqv.
state
)
stop
err_no
end
subroutine
s2
(
state
,
err_no
)
logical
::
state
integer
::
err_no
if
(
associated
(
u
,
v
)
.neqv.
state
)
stop
err_no
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment