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
3d980b9f
Commit
3d980b9f
authored
Apr 18, 2002
by
Bernd Schmidt
Committed by
Bernd Schmidt
Apr 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plug memory leak in handle_vector_size_attribute
From-SVN: r52466
parent
58c2956c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
4 deletions
+45
-4
gcc/ChangeLog
+6
-0
gcc/attribs.c
+39
-4
No files found.
gcc/ChangeLog
View file @
3d980b9f
2002-04-18 Bernd Schmidt <bernds@redhat.com>
* attribs.c (vector_type_node_list): New static variable.
(handle_vector_size_attribute): Use it to avoid generating a
new type node each time we are called.
2002-04-18 Roger Sayle <roger@eyesopen.com>
2002-04-18 Roger Sayle <roger@eyesopen.com>
Jakub Jelinek <jakub@redhat.com>
Jakub Jelinek <jakub@redhat.com>
...
...
gcc/attribs.c
View file @
3d980b9f
...
@@ -1268,6 +1268,13 @@ handle_deprecated_attribute (node, name, args, flags, no_add_attrs)
...
@@ -1268,6 +1268,13 @@ handle_deprecated_attribute (node, name, args, flags, no_add_attrs)
return
NULL_TREE
;
return
NULL_TREE
;
}
}
/* Keep a list of vector type nodes we created in handle_vector_size_attribute,
to prevent us from duplicating type nodes unnecessarily.
The normal mechanism to prevent duplicates is to use type_hash_canon, but
since we want to distinguish types that are essentially identical (except
for their debug representation), we use a local list here. */
static
tree
vector_type_node_list
=
0
;
/* Handle a "vector_size" attribute; arguments as in
/* Handle a "vector_size" attribute; arguments as in
struct attribute_spec.handler. */
struct attribute_spec.handler. */
...
@@ -1281,7 +1288,8 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
...
@@ -1281,7 +1288,8 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
{
{
unsigned
HOST_WIDE_INT
vecsize
,
nunits
;
unsigned
HOST_WIDE_INT
vecsize
,
nunits
;
enum
machine_mode
mode
,
orig_mode
,
new_mode
;
enum
machine_mode
mode
,
orig_mode
,
new_mode
;
tree
type
=
*
node
,
new_type
;
tree
type
=
*
node
,
new_type
=
NULL_TREE
;
tree
type_list_node
;
*
no_add_attrs
=
true
;
*
no_add_attrs
=
true
;
...
@@ -1338,10 +1346,33 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
...
@@ -1338,10 +1346,33 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
}
}
if
(
new_mode
==
VOIDmode
)
if
(
new_mode
==
VOIDmode
)
{
error
(
"no vector mode with the size and type specified could be found"
);
error
(
"no vector mode with the size and type specified could be found"
);
else
return
NULL_TREE
;
}
for
(
type_list_node
=
vector_type_node_list
;
type_list_node
;
type_list_node
=
TREE_CHAIN
(
type_list_node
))
{
{
tree
index
,
array
,
rt
;
tree
other_type
=
TREE_VALUE
(
type_list_node
);
tree
record
=
TYPE_DEBUG_REPRESENTATION_TYPE
(
other_type
);
tree
fields
=
TYPE_FIELDS
(
record
);
tree
field_type
=
TREE_TYPE
(
fields
);
tree
array_type
=
TREE_TYPE
(
field_type
);
if
(
TREE_CODE
(
fields
)
!=
FIELD_DECL
||
TREE_CODE
(
field_type
)
!=
ARRAY_TYPE
)
abort
();
if
(
TYPE_MODE
(
other_type
)
==
mode
&&
type
==
array_type
)
{
new_type
=
other_type
;
break
;
}
}
if
(
new_type
==
NULL_TREE
)
{
tree
index
,
array
,
rt
,
list_node
;
new_type
=
(
*
lang_hooks
.
types
.
type_for_mode
)
(
new_mode
,
new_type
=
(
*
lang_hooks
.
types
.
type_for_mode
)
(
new_mode
,
TREE_UNSIGNED
(
type
));
TREE_UNSIGNED
(
type
));
...
@@ -1367,9 +1398,13 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
...
@@ -1367,9 +1398,13 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
layout_type
(
rt
);
layout_type
(
rt
);
TYPE_DEBUG_REPRESENTATION_TYPE
(
new_type
)
=
rt
;
TYPE_DEBUG_REPRESENTATION_TYPE
(
new_type
)
=
rt
;
list_node
=
build_tree_list
(
NULL
,
new_type
);
TREE_CHAIN
(
list_node
)
=
vector_type_node_list
;
vector_type_node_list
=
list_node
;
}
/* Build back pointers if needed. */
/* Build back pointers if needed. */
*
node
=
vector_size_helper
(
*
node
,
new_type
);
*
node
=
vector_size_helper
(
*
node
,
new_type
);
}
return
NULL_TREE
;
return
NULL_TREE
;
}
}
...
...
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