<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Check undefined init_priority static object dependency"
href="http://llvm.org/bugs/show_bug.cgi?id=20066">20066</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Check undefined init_priority static object dependency
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ich@az2000.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Example:
header.h:
extern int a;
extern int b;
a.cpp:
#include "header.h"
int a = 2;
b.cpp:
#include "header.h"
int b = a;
main.cpp:
#include <stdio.h>
#include "header.h"
__attribute__((constructor))
static void init() {
printf("init: %i %i\n", a, b);
}
int main() {}
---
a and b will both get the same init_priority (I think it's
DEFAULT_INIT_PRIORITY = 65535), and thus it's not well defined whether a or b
is initialized first.
I would like to have a check, if the initialization of a global/static variable
depends on another global/static variable (int b = a), its init_priority must
be a bigger value than of all its dependencies.
---
In case that you wont implement this feature in the (near) future, maybe you
can give some guidance about what I need to do to implement such a static check
myself.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>