|
39 | 39 | print 'opt level:', opts |
40 | 40 |
|
41 | 41 | print 'Tried %d, notes: %s' % (tried, notes) |
42 | | - print '1) Generate C' |
| 42 | + print '1) Generate source' |
43 | 43 | extra_args = [] |
44 | 44 | if random.random() < 0.5: extra_args += ['--no-math64'] |
45 | 45 | suffix = '.c' |
| 46 | + COMP = shared.CLANG_CC |
46 | 47 | if random.random() < 0.5: |
47 | 48 | extra_args += ['--lang-cpp'] |
48 | 49 | suffix += 'pp' |
49 | | - print extra_args |
| 50 | + COMP = shared.CLANG |
| 51 | + print COMP, extra_args |
50 | 52 | fullname = filename + suffix |
51 | 53 | check_call([CSMITH, '--no-volatiles', '--no-packed-struct'] + extra_args, |
52 | 54 | #['--max-block-depth', '2', '--max-block-size', '2', '--max-expr-complexity', '2', '--max-funcs', '2'], |
|
57 | 59 |
|
58 | 60 | print '2) Compile natively' |
59 | 61 | shared.try_delete(filename) |
60 | | - shared.check_execute([shared.CLANG_CC, opts, fullname, '-o', filename + '1'] + CSMITH_CFLAGS) # + shared.EMSDK_OPTS |
61 | | - shared.check_execute([shared.CLANG_CC, opts, '-emit-llvm', '-c', '-Xclang', '-triple=i386-pc-linux-gnu', fullname, '-o', filename + '.bc'] + CSMITH_CFLAGS + shared.EMSDK_OPTS) |
| 62 | + try: |
| 63 | + shared.check_execute([COMP, opts, fullname, '-o', filename + '1'] + CSMITH_CFLAGS) # + shared.EMSDK_OPTS |
| 64 | + except Exception, e: |
| 65 | + print 'Failed to compile natively using clang', e |
| 66 | + notes['invalid'] += 1 |
| 67 | + continue |
| 68 | + |
| 69 | + shared.check_execute([COMP, opts, '-emit-llvm', '-c', '-Xclang', '-triple=i386-pc-linux-gnu', fullname, '-o', filename + '.bc'] + CSMITH_CFLAGS + shared.EMSDK_OPTS) |
62 | 70 | shared.check_execute([shared.path_from_root('tools', 'nativize_llvm.py'), filename + '.bc']) |
63 | 71 | shutil.move(filename + '.bc.run', filename + '2') |
64 | | - shared.check_execute([shared.CLANG_CC, fullname, '-o', filename + '3'] + CSMITH_CFLAGS) |
| 72 | + shared.check_execute([COMP, fullname, '-o', filename + '3'] + CSMITH_CFLAGS) |
65 | 73 | print '3) Run natively' |
66 | 74 | try: |
67 | 75 | correct1 = shared.jsrun.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 3) |
|
0 commit comments