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
4a426e36
Commit
4a426e36
authored
Sep 13, 2018
by
Bernd Edlinger
Committed by
Jeff Law
Sep 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* c-typeck.c (digest_init): Shorten overlength strings.
From-SVN: r264291
parent
84cdf51d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
gcc/c/ChangeLog
+4
-0
gcc/c/c-typeck.c
+11
-4
No files found.
gcc/c/ChangeLog
View file @
4a426e36
2018
-
09
-
13
Bernd
Edlinger
<
bernd
.
edlinger
@hotmail
.
de
>
*
c
-
typeck
.
c
(
digest_init
)
:
Shorten
overlength
strings
.
2018
-
09
-
06
Bernd
Edlinger
<
bernd
.
edlinger
@hotmail
.
de
>
*
c
-
decl
.
c
(
finish_decl
)
:
Call
complete_flexible_array_elts
.
...
...
gcc/c/c-typeck.c
View file @
4a426e36
...
...
@@ -7485,19 +7485,17 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
}
}
TREE_TYPE
(
inside_init
)
=
type
;
if
(
TYPE_DOMAIN
(
type
)
!=
NULL_TREE
&&
TYPE_SIZE
(
type
)
!=
NULL_TREE
&&
TREE_CODE
(
TYPE_SIZE
(
type
))
==
INTEGER_CST
)
{
unsigned
HOST_WIDE_INT
len
=
TREE_STRING_LENGTH
(
inside_init
);
unsigned
unit
=
TYPE_PRECISION
(
typ1
)
/
BITS_PER_UNIT
;
/* Subtract the size of a single (possibly wide) character
because it's ok to ignore the terminating null char
that is counted in the length of the constant. */
if
(
compare_tree_int
(
TYPE_SIZE_UNIT
(
type
),
(
len
-
(
TYPE_PRECISION
(
typ1
)
/
BITS_PER_UNIT
)))
<
0
)
if
(
compare_tree_int
(
TYPE_SIZE_UNIT
(
type
),
len
-
unit
)
<
0
)
pedwarn_init
(
init_loc
,
0
,
(
"initializer-string for array of chars "
"is too long"
));
...
...
@@ -7506,8 +7504,17 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
warning_at
(
init_loc
,
OPT_Wc___compat
,
(
"initializer-string for array chars "
"is too long for C++"
));
if
(
compare_tree_int
(
TYPE_SIZE_UNIT
(
type
),
len
)
<
0
)
{
unsigned
HOST_WIDE_INT
size
=
tree_to_uhwi
(
TYPE_SIZE_UNIT
(
type
));
const
char
*
p
=
TREE_STRING_POINTER
(
inside_init
);
inside_init
=
build_string
(
size
,
p
);
}
}
TREE_TYPE
(
inside_init
)
=
type
;
return
inside_init
;
}
else
if
(
INTEGRAL_TYPE_P
(
typ1
))
...
...
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