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
62c986af
Commit
62c986af
authored
Aug 04, 2014
by
Jakub Jelinek
Committed by
Jakub Jelinek
Aug 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* runtime/memory.c (xmallocarray): Avoid division for the common case.
From-SVN: r213593
parent
3696163c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
libgfortran/ChangeLog
+4
-0
libgfortran/runtime/memory.c
+3
-1
No files found.
libgfortran/ChangeLog
View file @
62c986af
2014-08-04 Jakub Jelinek <jakub@redhat.com>
* runtime/memory.c (xmallocarray): Avoid division for the common case.
2014-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
2014-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61632
PR libgfortran/61632
...
...
libgfortran/runtime/memory.c
View file @
62c986af
...
@@ -56,7 +56,9 @@ xmallocarray (size_t nmemb, size_t size)
...
@@ -56,7 +56,9 @@ xmallocarray (size_t nmemb, size_t size)
if
(
!
nmemb
||
!
size
)
if
(
!
nmemb
||
!
size
)
size
=
nmemb
=
1
;
size
=
nmemb
=
1
;
else
if
(
nmemb
>
SIZE_MAX
/
size
)
#define HALF_SIZE_T (((size_t) 1) << (__CHAR_BIT__ * sizeof (size_t) / 2))
else
if
(
__builtin_expect
((
nmemb
|
size
)
>=
HALF_SIZE_T
,
0
)
&&
nmemb
>
SIZE_MAX
/
size
)
{
{
errno
=
ENOMEM
;
errno
=
ENOMEM
;
os_error
(
"Integer overflow in xmallocarray"
);
os_error
(
"Integer overflow in xmallocarray"
);
...
...
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