[New-bugs-announce] [issue13874] test_faulthandler: read_null test fails with current clang

Stefan Krah report at bugs.python.org
Thu Jan 26 14:34:47 CET 2012


New submission from Stefan Krah <stefan-usenet at bytereef.org>:

In non-debug mode the read_null test fails with clang-3.0:

======================================================================
FAIL: test_disable (test.test_faulthandler.FaultHandlerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/stefan/hg/cpython/Lib/test/test_faulthandler.py", line 235, in test_disable
    self.assertNotEqual(exitcode, 0)
AssertionError: 0 == 0



clang "optimizes" the undefined behavior into a simple assignment:


$ ~/usr/bin/clang --version
clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-unknown-freebsd9.0
Thread model: posix
$ 
$ cat read_null.c
#include <stdio.h>

int
main(void)
{
    int *x = NULL, y;

    y = *x;
    printf("%d\n", y);

    return 0;
}
$ 
$ ~/usr/bin/clang -Wall -O0 -g -o read_null read_null.c 
$ ./read_null 
Segmentation fault: 11 (core dumped)
$ ~/usr/bin/clang -Wall -O3 -g -o read_null read_null.c 
$ ./read_null 
0

----------
components: Tests
messages: 152007
nosy: haypo, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: test_faulthandler: read_null test fails with current clang
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13874>
_______________________________________


More information about the New-bugs-announce mailing list