OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="pnacl-undefined-behavior"> | 3 <section id="pnacl-undefined-behavior"> |
4 <h1 id="pnacl-undefined-behavior">PNaCl Undefined Behavior</h1> | 4 <h1 id="pnacl-undefined-behavior">PNaCl Undefined Behavior</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><a class="reference internal" href="#overview" id="id2">Overview</a></li> | 7 <li><a class="reference internal" href="#overview" id="id2">Overview</a></li> |
8 <li><a class="reference internal" href="#specification" id="id3">Specification</
a></li> | 8 <li><a class="reference internal" href="#specification" id="id3">Specification</
a></li> |
9 <li><p class="first"><a class="reference internal" href="#behavior-in-pnacl-bitc
ode" id="id4">Behavior in PNaCl Bitcode</a></p> | 9 <li><p class="first"><a class="reference internal" href="#behavior-in-pnacl-bitc
ode" id="id4">Behavior in PNaCl Bitcode</a></p> |
10 <ul class="small-gap"> | 10 <ul class="small-gap"> |
11 <li><a class="reference internal" href="#well-defined" id="id5">Well-Defined</a>
</li> | 11 <li><a class="reference internal" href="#well-defined" id="id5">Well-Defined</a>
</li> |
12 <li><p class="first"><a class="reference internal" href="#not-well-defined" id="
id6">Not Well-Defined</a></p> | 12 <li><p class="first"><a class="reference internal" href="#not-well-defined" id="
id6">Not Well-Defined</a></p> |
13 <ul class="small-gap"> | 13 <ul class="small-gap"> |
14 <li><a class="reference internal" href="#potentially-fixable" id="id7">Potential
ly Fixable</a></li> | 14 <li><a class="reference internal" href="#potentially-fixable" id="id7">Potential
ly Fixable</a></li> |
15 <li><a class="reference internal" href="#floating-point" id="id8">Floating-Point
</a></li> | 15 <li><a class="reference internal" href="#floating-point" id="id8">Floating-Point
</a></li> |
16 <li><a class="reference internal" href="#hard-to-fix" id="id9">Hard to Fix</a></
li> | 16 <li><a class="reference internal" href="#simd-vectors" id="id9">SIMD Vectors</a>
</li> |
| 17 <li><a class="reference internal" href="#hard-to-fix" id="id10">Hard to Fix</a><
/li> |
17 </ul> | 18 </ul> |
18 </li> | 19 </li> |
19 </ul> | 20 </ul> |
20 </li> | 21 </li> |
21 </ul> | 22 </ul> |
22 | 23 |
23 </div><section id="overview"> | 24 </div><section id="overview"> |
24 <span id="undefined-behavior"></span><h2 id="overview"><span id="undefined-behav
ior"></span>Overview</h2> | 25 <span id="undefined-behavior"></span><h2 id="overview"><span id="undefined-behav
ior"></span>Overview</h2> |
25 <p>C and C++ undefined behavior allows efficient mapping of the source | 26 <p>C and C++ undefined behavior allows efficient mapping of the source |
26 language onto hardware, but leads to different behavior on different | 27 language onto hardware, but leads to different behavior on different |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 could mandate flush-to-zero, and may give an API to enable denormals | 168 could mandate flush-to-zero, and may give an API to enable denormals |
168 in a future release. The latter is problematic for SIMD and | 169 in a future release. The latter is problematic for SIMD and |
169 vectorization support, where some platforms do not support denormal | 170 vectorization support, where some platforms do not support denormal |
170 SIMD operations.</li> | 171 SIMD operations.</li> |
171 <li><code>NaN</code> values are currently not guaranteed to be canonical; see <a
class="reference external" href="https://code.google.com/p/nativeclient/issues/
detail?id=3536">bug | 172 <li><code>NaN</code> values are currently not guaranteed to be canonical; see <a
class="reference external" href="https://code.google.com/p/nativeclient/issues/
detail?id=3536">bug |
172 3536</a>.</li> | 173 3536</a>.</li> |
173 <li>Passing <code>NaN</code> to STL functions (the math is defined, but the | 174 <li>Passing <code>NaN</code> to STL functions (the math is defined, but the |
174 function implementation isn’t, e.g. <code>std::min</code> and <code>std::m
ax</code>), is | 175 function implementation isn’t, e.g. <code>std::min</code> and <code>std::m
ax</code>), is |
175 well-defined in the <em>pexe</em>.</li> | 176 well-defined in the <em>pexe</em>.</li> |
176 </ul> | 177 </ul> |
| 178 </section><section id="simd-vectors"> |
| 179 <h4 id="simd-vectors">SIMD Vectors</h4> |
| 180 <p>SIMD vector instructions aren’t part of the C/C++ standards and as such |
| 181 their behavior isn’t specified at all in C/C++; it is usually left up to |
| 182 the target architecture to specify behavior. Portable Native Client |
| 183 instead exposed <a class="reference internal" href="/native-client/reference/pna
cl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors<
/em></a> and |
| 184 offers the same guarantees on these vectors as the guarantees offered by |
| 185 the contained elements. Of notable interest amongst these guarantees are |
| 186 those of alignment for load/store instructions on vectors: they have the |
| 187 same alignment restriction as the contained elements.</p> |
177 </section><section id="hard-to-fix"> | 188 </section><section id="hard-to-fix"> |
178 <h4 id="hard-to-fix">Hard to Fix</h4> | 189 <h4 id="hard-to-fix">Hard to Fix</h4> |
179 <ul class="small-gap"> | 190 <ul class="small-gap"> |
180 <li><p class="first">Null pointer/reference has behavior determined by the NaCl
sandbox:</p> | 191 <li><p class="first">Null pointer/reference has behavior determined by the NaCl
sandbox:</p> |
181 <ul class="small-gap"> | 192 <ul class="small-gap"> |
182 <li>Raises a segmentation fault in the bottom <code>64KiB</code> bytes on all | 193 <li>Raises a segmentation fault in the bottom <code>64KiB</code> bytes on all |
183 platforms, and on some sandboxes there are further non-writable | 194 platforms, and on some sandboxes there are further non-writable |
184 pages after the initial <code>64KiB</code>.</li> | 195 pages after the initial <code>64KiB</code>.</li> |
185 <li>Negative offsets aren’t handled consistently on all platforms: | 196 <li>Negative offsets aren’t handled consistently on all platforms: |
186 x86-64 and ARM will wrap around to the stack (because they mask the | 197 x86-64 and ARM will wrap around to the stack (because they mask the |
(...skipping 29 matching lines...) Expand all Loading... |
216 dependent on stack and memory allocation.</li> | 227 dependent on stack and memory allocation.</li> |
217 <li>Data races: any two operations that conflict (target overlapping | 228 <li>Data races: any two operations that conflict (target overlapping |
218 memory), at least one of which is a store or atomic read-modify-write, | 229 memory), at least one of which is a store or atomic read-modify-write, |
219 and at least one of which is not atomic: this will be very dependent | 230 and at least one of which is not atomic: this will be very dependent |
220 on processor and execution sequence, see <a class="reference internal" href="/na
tive-client/reference/pnacl-c-cpp-language-support.html#memory-model-and-atomics
"><em>Memory Model and | 231 on processor and execution sequence, see <a class="reference internal" href="/na
tive-client/reference/pnacl-c-cpp-language-support.html#memory-model-and-atomics
"><em>Memory Model and |
221 Atomics</em></a>.</li> | 232 Atomics</em></a>.</li> |
222 </ul> | 233 </ul> |
223 </section></section></section></section> | 234 </section></section></section></section> |
224 | 235 |
225 {{/partials.standard_nacl_article}} | 236 {{/partials.standard_nacl_article}} |
OLD | NEW |