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
a31d78c6
Commit
a31d78c6
authored
Jun 11, 2016
by
Eric Botcazou
Committed by
Eric Botcazou
Jun 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* gcc-interface/trans.c (Case_Statement_to_gnu): Deal with characters.
From-SVN: r237326
parent
773392af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
3 deletions
+37
-3
gcc/ada/ChangeLog
+4
-0
gcc/ada/gcc-interface/trans.c
+10
-3
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/gnat.dg/case_character.adb
+19
-0
No files found.
gcc/ada/ChangeLog
View file @
a31d78c6
2016
-
06
-
11
Eric
Botcazou
<
ebotcazou
@
adacore
.
com
>
*
gcc
-
interface
/
trans
.
c
(
Case_Statement_to_gnu
):
Deal
with
characters
.
2016
-
06
-
11
Pierre
-
Marie
de
Rodat
<
derodat
@
adacore
.
com
>
*
gcc
-
interface
/
decl
.
c
(
gnat_to_gnu_entity
):
Do
not
clobber
...
...
gcc/ada/gcc-interface/trans.c
View file @
a31d78c6
...
...
@@ -2472,13 +2472,15 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
static
tree
Case_Statement_to_gnu
(
Node_Id
gnat_node
)
{
tree
gnu_result
,
gnu_expr
,
gnu_label
;
tree
gnu_result
,
gnu_expr
,
gnu_
type
,
gnu_
label
;
Node_Id
gnat_when
;
location_t
end_locus
;
bool
may_fallthru
=
false
;
gnu_expr
=
gnat_to_gnu
(
Expression
(
gnat_node
));
gnu_expr
=
convert
(
get_base_type
(
TREE_TYPE
(
gnu_expr
)),
gnu_expr
);
gnu_expr
=
maybe_character_value
(
gnu_expr
);
gnu_type
=
TREE_TYPE
(
gnu_expr
);
/* We build a SWITCH_EXPR that contains the code with interspersed
CASE_LABEL_EXPRs for each label. */
...
...
@@ -2548,6 +2550,11 @@ Case_Statement_to_gnu (Node_Id gnat_node)
gcc_assert
(
!
gnu_low
||
TREE_CODE
(
gnu_low
)
==
INTEGER_CST
);
gcc_assert
(
!
gnu_high
||
TREE_CODE
(
gnu_high
)
==
INTEGER_CST
);
if
(
gnu_low
&&
TREE_TYPE
(
gnu_low
)
!=
gnu_type
)
gnu_low
=
convert
(
gnu_type
,
gnu_low
);
if
(
gnu_high
&&
TREE_TYPE
(
gnu_high
)
!=
gnu_type
)
gnu_high
=
convert
(
gnu_type
,
gnu_high
);
add_stmt_with_node
(
build_case_label
(
gnu_low
,
gnu_high
,
label
),
gnat_choice
);
choices_added_p
=
true
;
...
...
@@ -2579,8 +2586,8 @@ Case_Statement_to_gnu (Node_Id gnat_node)
/* Now emit a definition of the label the cases branch to, if any. */
if
(
may_fallthru
)
add_stmt
(
build1
(
LABEL_EXPR
,
void_type_node
,
gnu_label
));
gnu_result
=
build3
(
SWITCH_EXPR
,
TREE_TYPE
(
gnu_expr
),
gnu_expr
,
end_stmt_group
(),
NULL_TREE
);
gnu_result
=
build3
(
SWITCH_EXPR
,
gnu_type
,
gnu_expr
,
end_stmt_group
(),
NULL_TREE
);
return
gnu_result
;
}
...
...
gcc/testsuite/ChangeLog
View file @
a31d78c6
2016-06-11 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/case_character.adb: New test.
2016-06-11 Segher Boessenkool <segher@kernel.crashing.org>
PR middle-end/71310
...
...
gcc/testsuite/gnat.dg/case_character.adb
0 → 100644
View file @
a31d78c6
-- { dg-do run }
procedure Case_Character is
function Test (C : Character) return Integer is
begin
case C is
when ASCII.HT | ' ' .. Character'Last => return 1;
when others => return 0;
end case;
end;
begin
if Test ('A') /= 1 then
raise Program_Error;
end if;
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