Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
6532e427
Commit
6532e427
authored
21 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
* Fix divide by zero error with empty structs
* Empty structs should have ALIGNMENT 1, not SIZE 1. llvm-svn: 6263
parent
2a651d7a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/Target/TargetData.cpp
+3
-5
3 additions, 5 deletions
llvm/lib/Target/TargetData.cpp
with
3 additions
and
5 deletions
llvm/lib/Target/TargetData.cpp
+
3
−
5
View file @
6532e427
...
...
@@ -56,15 +56,13 @@ StructLayout::StructLayout(const StructType *ST, const TargetData &TD)
StructSize
+=
TySize
;
// Consume space for this data item
}
// Empty structures have alignment of 1 byte.
if
(
StructAlignment
==
0
)
StructAlignment
=
1
;
// Add padding to the end of the struct so that it could be put in an array
// and all array elements would be aligned correctly.
if
(
StructSize
%
StructAlignment
!=
0
)
StructSize
=
(
StructSize
/
StructAlignment
+
1
)
*
StructAlignment
;
if
(
StructSize
==
0
)
{
StructSize
=
1
;
// Empty struct is 1 byte
StructAlignment
=
1
;
}
}
Annotation
*
TargetData
::
TypeAnFactory
(
AnnotationID
AID
,
const
Annotable
*
T
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment