-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rcache: initialize common symbol mca_rcache_base_used_mem_hooks
- Loading branch information
1 parent
beecf1b
commit 9980916
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9980916
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hjelmn can you please double check this ?
this was reported as a non initialized common symbol, but when i checked the source code,
it seems this variable is expected to be initialized to zero.
9980916
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In c file scope variables are always initialized to 0.
9980916
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am afraid i do not understand your comment
here is the output of make install
mca_rcache_base_used_mem_hooks
is not declaredstatic
(is this what you meant by file scope ?), and it is even declaredextern
inopal/mca/mpool/base/base.h
9980916
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any variable that is not declared in a function (stack) will always get initialized to 0. Per C99 § 6.7.8
Per C99 § 6.2.4 the variable has static storage duration:
9980916
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what I am saying is that the assumption that the variable is initialized to 0 is correct because it is always the case in C99. The common symbol stuff might indicate not that it should be initialized but that I should look and see if the variable really should be visible outside this scope.