diff options
-rwxr-xr-x | emcc | 1 | ||||
-rw-r--r-- | src/library.js | 57 | ||||
-rw-r--r-- | src/library_browser.js | 8 | ||||
-rw-r--r-- | src/library_fs.js | 8 | ||||
-rw-r--r-- | src/library_gl.js | 111 | ||||
-rw-r--r-- | src/library_html5.js | 179 | ||||
-rw-r--r-- | src/library_memfs.js | 5 | ||||
-rw-r--r-- | src/library_sockfs.js | 2 | ||||
-rw-r--r-- | src/postamble.js | 12 | ||||
-rw-r--r-- | src/preamble.js | 248 | ||||
-rw-r--r-- | tests/cases/atomicrmw_dec.ll | 21 | ||||
-rw-r--r-- | tests/cases/atomicrmw_dec.txt | 1 | ||||
-rw-r--r-- | tests/cases/dollar.ll | 22 | ||||
-rw-r--r-- | tests/cases/ptrtoint_blockaddr.ll | 14 | ||||
-rw-r--r-- | tests/fuzz/18.cpp | 1125 | ||||
-rw-r--r-- | tests/fuzz/18.cpp.txt | 1 | ||||
-rwxr-xr-x | tests/fuzz/creduce_tester.py | 2 | ||||
-rwxr-xr-x | tests/fuzz/csmith_driver.py | 4 | ||||
-rwxr-xr-x | tests/fuzz/test.sh | 3 | ||||
-rwxr-xr-x | tests/fuzz/testpp.sh | 51 | ||||
-rw-r--r-- | tests/printf/output.txt | 1 | ||||
-rw-r--r-- | tests/printf/test.c | 1 | ||||
-rw-r--r-- | tests/test_browser.py | 2 | ||||
-rw-r--r-- | tests/test_core.py | 12 | ||||
-rw-r--r-- | tests/test_sanity.py | 12 | ||||
-rw-r--r-- | tools/make_minigzip.py | 2 |
26 files changed, 1613 insertions, 292 deletions
@@ -1217,6 +1217,7 @@ try: assert not split_js_file, '--split-js is deprecated and not supported in fastcomp' assert not bind, 'embind not supported in fastcomp yet' assert shared.Settings.MAX_SETJMPS == 20, 'changing MAX_SETJMPS is not supported in fastcomp yet' + assert shared.Settings.INIT_HEAP == 0, 'HEAP_INIT is not supported in fastcomp (and should never be needed except for debugging)' if jcache: logging.warning('jcache is not supported in fastcomp (you should not need it anyhow), disabling') jcache = False diff --git a/src/library.js b/src/library.js index 6bbacad3..91d5f925 100644 --- a/src/library.js +++ b/src/library.js @@ -131,7 +131,7 @@ LibraryManager.library = { stream.position++; return 0; }, - readdir__deps: ['readdir_r', '__setErrNo', '$ERRNO_CODES'], + readdir__deps: ['readdir_r', '__setErrNo', '$ERRNO_CODES', 'malloc'], readdir: function(dirp) { // struct dirent *readdir(DIR *dirp); // http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir_r.html @@ -1021,7 +1021,7 @@ LibraryManager.library = { return -1; } }, - ttyname__deps: ['ttyname_r'], + ttyname__deps: ['ttyname_r', 'malloc'], ttyname: function(fildes) { // char *ttyname(int fildes); // http://pubs.opengroup.org/onlinepubs/000095399/functions/ttyname.html @@ -1287,7 +1287,7 @@ LibraryManager.library = { return -1; } }, - getlogin__deps: ['getlogin_r'], + getlogin__deps: ['getlogin_r', 'malloc'], getlogin: function() { // char *getlogin(void); // http://pubs.opengroup.org/onlinepubs/000095399/functions/getlogin.html @@ -1970,7 +1970,7 @@ LibraryManager.library = { } next = {{{ makeGetValue(0, 'textIndex+1', 'i8') }}}; } - if (precision === -1) { + if (precision < 0) { precision = 6; // Standard default. precisionSet = false; } @@ -2695,7 +2695,7 @@ LibraryManager.library = { if (buf) _setvbuf(stream, buf, 0, 8192); // _IOFBF, BUFSIZ. else _setvbuf(stream, buf, 2, 8192); // _IONBF, BUFSIZ. }, - tmpnam__deps: ['$FS'], + tmpnam__deps: ['$FS', 'malloc'], tmpnam: function(s, dir, prefix) { // char *tmpnam(char *s); // http://pubs.opengroup.org/onlinepubs/000095399/functions/tmpnam.html @@ -2792,7 +2792,7 @@ LibraryManager.library = { function unget() { index--; }; return __scanString(format, get, unget, varargs); }, - snprintf__deps: ['_formatString'], + snprintf__deps: ['_formatString', 'malloc'], snprintf: function(s, n, format, varargs) { // int snprintf(char *restrict s, size_t n, const char *restrict format, ...); // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html @@ -2903,7 +2903,7 @@ LibraryManager.library = { // sys/mman.h // ========================================================================== - mmap__deps: ['$FS'], + mmap__deps: ['$FS', 'malloc', 'memset'], mmap: function(start, num, prot, flags, fd, offset) { /* FIXME: Since mmap is normally implemented at the kernel level, * this implementation simply uses malloc underneath the call to @@ -3061,7 +3061,7 @@ LibraryManager.library = { return 0; }, - realloc__deps: ['memcpy'], + realloc__deps: ['malloc', 'memcpy', 'free'], realloc: function(ptr, size) { // Very simple, inefficient implementation - if you use a real malloc, best to use // a real realloc with it @@ -3275,7 +3275,7 @@ LibraryManager.library = { return _strtoll(ptr, null, 10); }, - qsort__deps: ['memcpy'], + qsort__deps: ['malloc', 'memcpy', 'free'], qsort: function(base, num, size, cmp) { if (num == 0 || size == 0) return; // forward calls to the JavaScript sort method @@ -3825,7 +3825,7 @@ LibraryManager.library = { }, rindex: 'strrchr', - strdup__deps: ['strlen'], + strdup__deps: ['strlen', 'malloc'], strdup: function(ptr) { var len = _strlen(ptr); var newStr = _malloc(len + 1); @@ -3834,7 +3834,7 @@ LibraryManager.library = { return newStr; }, - strndup__deps: ['strdup', 'strlen'], + strndup__deps: ['strdup', 'strlen', 'malloc'], strndup: function(ptr, size) { var len = _strlen(ptr); @@ -3942,7 +3942,7 @@ LibraryManager.library = { return ___setErrNo(ERRNO_CODES.EINVAL); } }, - strerror__deps: ['strerror_r'], + strerror__deps: ['strerror_r', 'malloc'], strerror: function(errnum) { if (!_strerror.buffer) _strerror.buffer = _malloc(256); _strerror_r(errnum, _strerror.buffer, 256); @@ -4080,6 +4080,7 @@ LibraryManager.library = { return _isgraph(chr); // no locale support yet }, // Lookup tables for glibc ctype implementation. + __ctype_b_loc__deps: ['malloc'], __ctype_b_loc: function() { // http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/baselib---ctype-b-loc.html var me = ___ctype_b_loc; @@ -4105,6 +4106,7 @@ LibraryManager.library = { } return me.ret; }, + __ctype_tolower_loc__deps: ['malloc'], __ctype_tolower_loc: function() { // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-tolower-loc.html var me = ___ctype_tolower_loc; @@ -4133,6 +4135,7 @@ LibraryManager.library = { } return me.ret; }, + __ctype_toupper_loc__deps: ['malloc'], __ctype_toupper_loc: function() { // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-toupper-loc.html var me = ___ctype_toupper_loc; @@ -4338,12 +4341,12 @@ LibraryManager.library = { __cxa_caught_exceptions: [], // Exceptions - __cxa_allocate_exception__deps: ['__cxa_exception_header_size'], + __cxa_allocate_exception__deps: ['__cxa_exception_header_size', 'malloc'], __cxa_allocate_exception: function(size) { var ptr = _malloc(size + ___cxa_exception_header_size); return ptr + ___cxa_exception_header_size; }, - __cxa_free_exception__deps: ['__cxa_exception_header_size'], + __cxa_free_exception__deps: ['__cxa_exception_header_size', 'free'], __cxa_free_exception: function(ptr) { try { return _free(ptr - ___cxa_exception_header_size); @@ -4414,7 +4417,7 @@ LibraryManager.library = { // we don't actually get the value that we allocated, but something else. Easiest // to remember that the last exception thrown is going to be the first to be caught, // so just use that value instead as it is what we're really looking for. - __cxa_begin_catch__deps: ['_ZSt18uncaught_exceptionv', '__cxa_caught_exceptions'], + __cxa_begin_catch__deps: ['_ZSt18uncaught_exceptionv', '__cxa_caught_exceptions', '__cxa_last_thrown_exception'], __cxa_begin_catch: function(ptr) { __ZSt18uncaught_exceptionv.uncaught_exception--; ___cxa_caught_exceptions.push(___cxa_last_thrown_exception); @@ -4449,14 +4452,13 @@ LibraryManager.library = { ___cxa_last_thrown_exception = 0; } }, - __cxa_get_exception_ptr__deps: ['___cxa_last_thrown_exception'], __cxa_get_exception_ptr: function(ptr) { return ptr; }, _ZSt18uncaught_exceptionv: function() { // std::uncaught_exception() return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, - __cxa_uncaught_exception__deps: ['_Zst18uncaught_exceptionv'], + __cxa_uncaught_exception__deps: ['_ZSt18uncaught_exceptionv'], __cxa_uncaught_exception: function() { return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, @@ -4532,7 +4534,7 @@ LibraryManager.library = { {{{ makeStructuralReturn(['thrown', 'throwntype']) }}}; }, - __resumeException__deps: [function() { Functions.libraryFunctions['__resumeException'] = 1 }], // will be called directly from compiled code + __resumeException__deps: [function() { Functions.libraryFunctions['__resumeException'] = 1 }, '__cxa_last_thrown_exception'], // will be called directly from compiled code __resumeException: function(ptr) { #if EXCEPTION_DEBUG Module.print("Resuming exception"); @@ -4585,7 +4587,7 @@ LibraryManager.library = { _ZNSt9exceptionD1Ev: function() {}, _ZNSt9exceptionD2Ev: function() {}, - _ZNKSt9exception4whatEv__deps: ['_malloc'], + _ZNKSt9exception4whatEv__deps: ['malloc'], _ZNKSt9exception4whatEv: function() { if (!__ZNKSt9exception4whatEv.buffer) { var name = "std::exception"; @@ -6466,6 +6468,7 @@ LibraryManager.library = { // langinfo.h // ========================================================================== + nl_langinfo__deps: ['malloc'], nl_langinfo: function(item) { // char *nl_langinfo(nl_item item); // http://pubs.opengroup.org/onlinepubs/000095399/functions/nl_langinfo.html @@ -7092,7 +7095,7 @@ LibraryManager.library = { } return addr; }, - inet_ntoa__deps: ['_inet_ntop4_raw'], + inet_ntoa__deps: ['_inet_ntop4_raw', 'malloc'], inet_ntoa: function(in_addr) { if (!_inet_ntoa.buffer) { _inet_ntoa.buffer = _malloc(1024); @@ -7454,7 +7457,7 @@ LibraryManager.library = { return _gethostbyname(hostp); }, - gethostbyname__deps: ['$DNS', '_inet_pton4_raw'], + gethostbyname__deps: ['$DNS', '_inet_pton4_raw', 'malloc'], gethostbyname: function(name) { name = Pointer_stringify(name); @@ -7487,7 +7490,7 @@ LibraryManager.library = { return 0; }, - getaddrinfo__deps: ['$Sockets', '$DNS', '_inet_pton4_raw', '_inet_ntop4_raw', '_inet_pton6_raw', '_inet_ntop6_raw', '_write_sockaddr', 'htonl'], + getaddrinfo__deps: ['$Sockets', '$DNS', '_inet_pton4_raw', '_inet_ntop4_raw', '_inet_pton6_raw', '_inet_ntop6_raw', '_write_sockaddr', 'htonl', 'malloc'], getaddrinfo: function(node, service, hint, out) { // Note getaddrinfo currently only returns a single addrinfo with ai_next defaulting to NULL. When NULL // hints are specified or ai_family set to AF_UNSPEC or ai_socktype or ai_protocol set to 0 then we @@ -7704,7 +7707,7 @@ LibraryManager.library = { // are actually negative numbers and you can't have expressions as keys in JavaScript literals. $GAI_ERRNO_MESSAGES: {}, - gai_strerror__deps: ['$GAI_ERRNO_MESSAGES'], + gai_strerror__deps: ['$GAI_ERRNO_MESSAGES', 'malloc'], gai_strerror: function(val) { var buflen = 256; @@ -7746,7 +7749,7 @@ LibraryManager.library = { list: [], map: {} }, - setprotoent__deps: ['$Protocols'], + setprotoent__deps: ['$Protocols', 'malloc'], setprotoent: function(stayopen) { // void setprotoent(int stayopen); @@ -8409,7 +8412,7 @@ LibraryManager.library = { } }, - getsockname__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr', '_inet_pton_raw'], + getsockname__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], getsockname: function (fd, addr, addrlen) { var sock = SOCKFS.getSocket(fd); if (!sock) { @@ -8427,7 +8430,7 @@ LibraryManager.library = { } }, - getpeername__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr', '_inet_pton_raw'], + getpeername__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], getpeername: function (fd, addr, addrlen) { var sock = SOCKFS.getSocket(fd); if (!sock) { @@ -8577,7 +8580,7 @@ LibraryManager.library = { } }, - recvmsg__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_inet_pton_raw', '_write_sockaddr'], + recvmsg__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], recvmsg: function(fd, message, flags) { var sock = SOCKFS.getSocket(fd); if (!sock) { diff --git a/src/library_browser.js b/src/library_browser.js index 46082281..b800292c 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -234,6 +234,10 @@ mergeInto(LibraryManager.library, { } #endif var ctx; + var errorInfo = '?'; + function onContextCreationError(event) { + errorInfo = event.statusMessage || errorInfo; + } try { if (useWebGL) { var contextAttributes = { @@ -251,10 +255,6 @@ mergeInto(LibraryManager.library, { contextAttributes.preserveDrawingBuffer = true; #endif - var errorInfo = '?'; - function onContextCreationError(event) { - errorInfo = event.statusMessage || errorInfo; - } canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false); try { ['experimental-webgl', 'webgl'].some(function(webglId) { diff --git a/src/library_fs.js b/src/library_fs.js index e97ba588..1428f041 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -616,13 +616,13 @@ mergeInto(LibraryManager.library, { }, // helpers to create specific types of nodes create: function(path, mode) { - mode = mode !== undefined ? mode : 0666; + mode = mode !== undefined ? mode : 438 /* 0666 */; mode &= {{{ cDefine('S_IALLUGO') }}}; mode |= {{{ cDefine('S_IFREG') }}}; return FS.mknod(path, mode, 0); }, mkdir: function(path, mode) { - mode = mode !== undefined ? mode : 0777; + mode = mode !== undefined ? mode : 511 /* 0777 */; mode &= {{{ cDefine('S_IRWXUGO') }}} | {{{ cDefine('S_ISVTX') }}}; mode |= {{{ cDefine('S_IFDIR') }}}; return FS.mknod(path, mode, 0); @@ -630,7 +630,7 @@ mergeInto(LibraryManager.library, { mkdev: function(path, mode, dev) { if (typeof(dev) === 'undefined') { dev = mode; - mode = 0666; + mode = 438 /* 0666 */; } mode |= {{{ cDefine('S_IFCHR') }}}; return FS.mknod(path, mode, dev); @@ -895,7 +895,7 @@ mergeInto(LibraryManager.library, { }, open: function(path, flags, mode, fd_start, fd_end) { flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; - mode = typeof mode === 'undefined' ? 0666 : mode; + mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode; if ((flags & {{{ cDefine('O_CREAT') }}})) { mode = (mode & {{{ cDefine('S_IALLUGO') }}}) | {{{ cDefine('S_IFREG') }}}; } else { diff --git a/src/library_gl.js b/src/library_gl.js index e3442a8a..7e4c5a97 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -19,6 +19,7 @@ var LibraryGL = { textures: [], uniforms: [], shaders: [], + vaos: [], #if FULL_ES2 clientBuffers: [], @@ -633,6 +634,9 @@ var LibraryGL = { // Extension available from Firefox 26 and Google Chrome 30 GL.instancedArraysExt = GLctx.getExtension('ANGLE_instanced_arrays'); + + // Extension available from Firefox 25 and WebKit + GL.vaoExt = Module.ctx.getExtension('OES_vertex_array_object'); // These are the 'safe' feature-enabling extensions that don't add any performance impact related to e.g. debugging, and // should be enabled by default so that client GLES2/GL code will not need to go through extra hoops to get its stuff working. @@ -1797,6 +1801,81 @@ var LibraryGL = { }, #if LEGACY_GL_EMULATION + glGenVertexArrays__deps: ['emulGlGenVertexArrays'], +#endif + glGenVertexArrays__sig: 'vii', + glGenVertexArrays: function (n, arrays) { +#if LEGACY_GL_EMULATION + _emulGlGenVertexArrays(n, arrays); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + for(var i = 0; i < n; i++) { + var id = GL.getNewId(GL.vaos); + var vao = GL.vaoExt.createVertexArrayOES(); + vao.name = id; + GL.vaos[id] = vao; + {{{ makeSetValue('arrays', 'i*4', 'id', 'i32') }}}; + } +#endif + }, + +#if LEGACY_GL_EMULATION + glDeleteVertexArrays__deps: ['emulGlDeleteVertexArrays'], +#endif + glDeleteVertexArrays__sig: 'vii', + glDeleteVertexArrays: function(n, vaos) { +#if LEGACY_GL_EMULATION + _emulGlDeleteVertexArrays(n, vaos); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + for(var i = 0; i < n; i++) { + var id = {{{ makeGetValue('vaos', 'i*4', 'i32') }}}; + GL.vaoExt.deleteVertexArrayOES(GL.vaos[id]); + GL.vaos[id] = null; + } +#endif + }, + +#if LEGACY_GL_EMULATION + glBindVertexArray__deps: ['emulGlBindVertexArray'], +#endif + glBindVertexArray__sig: 'vi', + glBindVertexArray: function(vao) { +#if LEGACY_GL_EMULATION + _emulGlBindVertexArray(vao); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + GL.vaoExt.bindVertexArrayOES(GL.vaos[vao]); +#endif + }, + +#if LEGACY_GL_EMULATION + glIsVertexArray__deps: ['emulGlIsVertexArray'], +#endif + glIsVertexArray__sig: 'ii', + glIsVertexArray: function(array) { +#if LEGACY_GL_EMULATION + return _emulGlIsVertexArray(array); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + var vao = GL.vaos[array]; + if (!vao) return 0; + return GL.vaoExt.isVertexArrayOES(vao); +#endif + }, + +#if LEGACY_GL_EMULATION // GL emulation: provides misc. functionality not present in OpenGL ES 2.0 or WebGL @@ -4809,9 +4888,9 @@ var LibraryGL = { }, // Vertex array object (VAO) support. TODO: when the WebGL extension is popular, use that and remove this code and GL.vaos - glGenVertexArrays__deps: ['$GLEmulation'], - glGenVertexArrays__sig: 'vii', - glGenVertexArrays: function(n, vaos) { + emulGlGenVertexArrays__deps: ['$GLEmulation'], + emulGlGenVertexArrays__sig: 'vii', + emulGlGenVertexArrays: function(n, vaos) { for (var i = 0; i < n; i++) { var id = GL.getNewId(GLEmulation.vaos); GLEmulation.vaos[id] = { @@ -4825,17 +4904,23 @@ var LibraryGL = { {{{ makeSetValue('vaos', 'i*4', 'id', 'i32') }}}; } }, - glDeleteVertexArrays__sig: 'vii', - glDeleteVertexArrays: function(n, vaos) { + emulGlDeleteVertexArrays__sig: 'vii', + emulGlDeleteVertexArrays: function(n, vaos) { for (var i = 0; i < n; i++) { var id = {{{ makeGetValue('vaos', 'i*4', 'i32') }}}; GLEmulation.vaos[id] = null; if (GLEmulation.currentVao && GLEmulation.currentVao.id == id) GLEmulation.currentVao = null; } }, - glBindVertexArray__deps: ['glBindBuffer', 'glEnableVertexAttribArray', 'glVertexAttribPointer', 'glEnableClientState'], - glBindVertexArray__sig: 'vi', - glBindVertexArray: function(vao) { + emulGlIsVertexArray__sig: 'vi', + emulGlIsVertexArray: function(array) { + var vao = GLEmulation.vaos[array]; + if (!vao) return 0; + return 1; + }, + emulGlBindVertexArray__deps: ['glBindBuffer', 'glEnableVertexAttribArray', 'glVertexAttribPointer', 'glEnableClientState'], + emulGlBindVertexArray__sig: 'vi', + emulGlBindVertexArray: function(vao) { // undo vao-related things, wipe the slate clean, both for vao of 0 or an actual vao GLEmulation.currentVao = null; // make sure the commands we run here are not recorded if (GLImmediate.lastRenderer) GLImmediate.lastRenderer.cleanup(); @@ -5034,21 +5119,23 @@ var LibraryGL = { glCheckFramebufferStatusOES : 'glCheckFramebufferStatus', glDeleteFramebuffersOES : 'glDeleteFramebuffers', glDeleteRenderbuffersOES : 'glDeleteRenderbuffers', - glGenVertexArraysOES: 'glGenVertexArrays', - glDeleteVertexArraysOES: 'glDeleteVertexArrays', - glBindVertexArrayOES: 'glBindVertexArray', glFramebufferTexture2DOES: 'glFramebufferTexture2D', #else // LEGACY_GL_EMULATION glVertexPointer: function(){ throw 'Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glGenVertexArrays: function(){ throw 'Legacy GL function (glGenVertexArrays) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glMatrixMode: function(){ throw 'Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glBegin: function(){ throw 'Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glLoadIdentity: function(){ throw 'Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, #endif // LEGACY_GL_EMULATION + // Open GLES1.1 vao compatibility (Could work w/o -s LEGACY_GL_EMULATION=1) + + glGenVertexArraysOES: 'glGenVertexArrays', + glDeleteVertexArraysOES: 'glDeleteVertexArrays', + glBindVertexArrayOES: 'glBindVertexArray', + // GLU gluPerspective: function(fov, aspect, near, far) { diff --git a/src/library_html5.js b/src/library_html5.js index a38c2390..a28bcb85 100644 --- a/src/library_html5.js +++ b/src/library_html5.js @@ -156,17 +156,17 @@ var LibraryJSEvents = { var e = event || window.event; writeStringToMemory(e.key ? e.key : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.key }}} ); writeStringToMemory(e.code ? e.code : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.code }}} ); - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.location, 'e.location', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.metaKey, 'e.metaKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.repeat, 'e.repeat', 'i32') }}} + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.location, 'e.location', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.metaKey, 'e.metaKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.repeat, 'e.repeat', 'i32') }}}; writeStringToMemory(e.locale ? e.locale : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.locale }}} ); writeStringToMemory(e.char ? e.char : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.charValue }}} ); - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.charCode, 'e.charCode', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.keyCode, 'e.keyCode', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.which, 'e.which', 'i32') }}} + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.charCode, 'e.charCode', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.keyCode, 'e.keyCode', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.which, 'e.which', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.keyEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -188,21 +188,21 @@ var LibraryJSEvents = { fillMouseEventData: function(eventStruct, e) { var rect = Module['canvas'].getBoundingClientRect(); - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenX, 'e.screenX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenY, 'e.screenY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientX, 'e.clientX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientY, 'e.clientY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.metaKey, 'e.metaKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.button, 'e.button', 'i16') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.buttons, 'e.buttons', 'i16') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementX, 'e.movementX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementY, 'e.movementY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasX, 'e.clientX - rect.left', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasY, 'e.clientY - rect.top', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenX, 'e.screenX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenY, 'e.screenY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientX, 'e.clientX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientY, 'e.clientY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.metaKey, 'e.metaKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.button, 'e.button', 'i16') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.buttons, 'e.buttons', 'i16') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementX, 'e.movementX || e.mozMovementX || e.webkitMovementX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementY, 'e.movementY || e.mozMovementY || e.webkitMovementY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasX, 'e.clientX - rect.left', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasY, 'e.clientY - rect.top', 'i32') }}}; }, registerMouseEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -236,10 +236,10 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; JSEvents.fillMouseEventData(JSEvents.wheelEvent, e); - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaX, 'e.deltaX', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'e.deltaY', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, 'e.deltaZ', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, 'e.deltaMode', 'i32') }}} + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaX, 'e.deltaX', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'e.deltaY', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, 'e.deltaZ', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, 'e.deltaMode', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.wheelEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -288,15 +288,15 @@ var LibraryJSEvents = { return; } var scrollPos = JSEvents.pageScrollPos(); - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, 'e.detail', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientWidth, 'document.body.clientWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientHeight, 'document.body.clientHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerWidth, 'window.innerWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerHeight, 'window.innerHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterWidth, 'window.outerWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterHeight, 'window.outerHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'scrollPos[0]', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'scrollPos[1]', 'i32') }}} + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, 'e.detail', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientWidth, 'document.body.clientWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientHeight, 'document.body.clientHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerWidth, 'window.innerWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerHeight, 'window.innerHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterWidth, 'window.outerWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterHeight, 'window.outerHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'scrollPos[0]', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'scrollPos[1]', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.uiEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -361,11 +361,11 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.alpha, 'e.alpha', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.beta, 'e.beta', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.gamma, 'e.gamma', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.absolute, 'e.absolute', 'i32') }}} + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.alpha, 'e.alpha', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.beta, 'e.beta', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.gamma, 'e.gamma', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.absolute, 'e.absolute', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.deviceOrientationEvent, userData]); if (shouldCancel) { @@ -391,16 +391,16 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationX, 'e.acceleration.x', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationY, 'e.acceleration.y', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationZ, 'e.acceleration.z', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityX, 'e.accelerationIncludingGravity.x', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityY, 'e.accelerationIncludingGravity.y', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityZ, 'e.accelerationIncludingGravity.z', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateAlpha, 'e.rotationRate.alpha', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateBeta, 'e.rotationRate.beta', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateGamma, 'e.rotationRate.gamma', 'double') }}} + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationX, 'e.acceleration.x', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationY, 'e.acceleration.y', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationZ, 'e.acceleration.z', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityX, 'e.accelerationIncludingGravity.x', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityY, 'e.accelerationIncludingGravity.y', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityZ, 'e.accelerationIncludingGravity.z', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateAlpha, 'e.rotationRate.alpha', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateBeta, 'e.rotationRate.beta', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateGamma, 'e.rotationRate.gamma', 'double') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.deviceMotionEvent, userData]); if (shouldCancel) { @@ -434,8 +434,8 @@ var LibraryJSEvents = { orientation = orientations2.indexOf(orientationString); } - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationIndex, '1 << orientation', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationAngle, 'window.orientation', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationIndex, '1 << orientation', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationAngle, 'window.orientation', 'i32') }}}; }, registerOrientationChangeEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -482,8 +482,8 @@ var LibraryJSEvents = { fillFullscreenChangeEventData: function(eventStruct, e) { var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement; var isFullscreen = !!fullscreenElement; - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.isFullscreen, 'isFullscreen', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.fullscreenEnabled, 'JSEvents.fullscreenEnabled()', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.isFullscreen, 'isFullscreen', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.fullscreenEnabled, 'JSEvents.fullscreenEnabled()', 'i32') }}}; var nodeName = JSEvents.getNodeNameForTarget(fullscreenElement); var id = (fullscreenElement && fullscreenElement.id) ? fullscreenElement.id : ''; writeStringToMemory(nodeName, eventStruct + {{{ C_STRUCTS.EmscriptenFullscreenChangeEvent.nodeName }}} ); @@ -547,7 +547,7 @@ var LibraryJSEvents = { fillPointerlockChangeEventData: function(eventStruct, e) { var pointerLockElement = document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement || document.msPointerLockElement; var isPointerlocked = !!pointerLockElement; - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenPointerlockChangeEvent.isActive, 'isPointerlocked', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenPointerlockChangeEvent.isActive, 'isPointerlocked', 'i32') }}}; var nodeName = JSEvents.getNodeNameForTarget(pointerLockElement); var id = (pointerLockElement && pointerLockElement.id) ? pointerLockElement.id : ''; writeStringToMemory(nodeName, eventStruct + {{{ C_STRUCTS.EmscriptenPointerlockChangeEvent.nodeName }}} ); @@ -612,8 +612,8 @@ var LibraryJSEvents = { var visibilityStates = [ "hidden", "visible", "prerender", "unloaded" ]; var visibilityState = visibilityStates.indexOf(document.visibilityState); - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.hidden, 'document.hidden', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.visibilityState, 'visibilityState', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.hidden, 'document.hidden', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.visibilityState, 'visibilityState', 'i32') }}}; }, registerVisibilityChangeEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -673,33 +673,33 @@ var LibraryJSEvents = { } var ptr = JSEvents.touchEvent; - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.metaKey, 'e.metaKey', 'i32') }}} + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.metaKey, 'e.metaKey', 'i32') }}}; ptr += {{{ C_STRUCTS.EmscriptenTouchEvent.touches }}}; // Advance to the start of the touch array. var rect = Module['canvas'].getBoundingClientRect(); var numTouches = 0; for(var i in touches) { var t = touches[i]; - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.identifier, 't.identifier', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenX, 't.screenX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenY, 't.screenY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientX, 't.clientX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientY, 't.clientY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageX, 't.pageX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageY, 't.pageY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.isChanged, 't.changed', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.onTarget, 't.onTarget', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasX, 't.clientX - rect.left', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasY, 't.clientY - rect.top', 'i32') }}} + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.identifier, 't.identifier', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenX, 't.screenX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenY, 't.screenY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientX, 't.clientX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientY, 't.clientY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageX, 't.pageX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageY, 't.pageY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.isChanged, 't.changed', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.onTarget, 't.onTarget', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasX, 't.clientX - rect.left', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasY, 't.clientY - rect.top', 'i32') }}}; ptr += {{{ C_STRUCTS.EmscriptenTouchPoint.__size__ }}}; if (++numTouches >= 32) { break; } } - {{{ makeSetValue('JSEvents.touchEvent', C_STRUCTS.EmscriptenTouchEvent.numTouches, 'numTouches', 'i32') }}} + {{{ makeSetValue('JSEvents.touchEvent', C_STRUCTS.EmscriptenTouchEvent.numTouches, 'numTouches', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.touchEvent, userData]); if (shouldCancel) { @@ -721,20 +721,20 @@ var LibraryJSEvents = { }, fillGamepadEventData: function(eventStruct, e) { - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.timestamp, 'e.timestamp', 'double') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.timestamp, 'e.timestamp', 'double') }}}; for(var i = 0; i < e.axes.length; ++i) { - {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}} + {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}}; } for(var i = 0; i < e.buttons.length; ++i) { - {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}} + {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}}; } for(var i = 0; i < e.buttons.length; ++i) { - {{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}} + {{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}}; } - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.connected, 'e.connected', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.index, 'e.index', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numAxes, 'e.axes.length', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numButtons, 'e.buttons.length', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.connected, 'e.connected', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.index, 'e.index', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numAxes, 'e.axes.length', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numButtons, 'e.buttons.length', 'i32') }}}; writeStringToMemory(e.id, eventStruct + {{{ C_STRUCTS.EmscriptenGamepadEvent.id }}} ); writeStringToMemory(e.mapping, eventStruct + {{{ C_STRUCTS.EmscriptenGamepadEvent.mapping }}} ); }, @@ -772,7 +772,8 @@ var LibraryJSEvents = { var confirmationMessage = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, 0, userData]); - confirmationMessage = Pointer_stringify(confirmationMessage); + if (confirmationMessage) + confirmationMessage = Pointer_stringify(confirmationMessage); if (confirmationMessage) { e.preventDefault(); e.returnValue = confirmationMessage; @@ -794,10 +795,10 @@ var LibraryJSEvents = { battery: function() { return navigator.battery || navigator.mozBattery || navigator.webkitBattery; }, fillBatteryEventData: function(eventStruct, e) { - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.chargingTime, 'e.chargingTime', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.dischargingTime, 'e.dischargingTime', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.level, 'e.level', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.charging, 'e.charging', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.chargingTime, 'e.chargingTime', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.dischargingTime, 'e.dischargingTime', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.level, 'e.level', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.charging, 'e.charging', 'i32') }}}; }, registerBatteryEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -1158,7 +1159,7 @@ var LibraryJSEvents = { var vibrateList = []; for(var i = 0; i < numEntries; ++i) { - var msecs = {{{ makeGetValue('msecsArray', 'i*4', 'i32') }}} + var msecs = {{{ makeGetValue('msecsArray', 'i*4', 'i32') }}}; vibrateList.push(msecs); } navigator.vibrate(vibrateList); diff --git a/src/library_memfs.js b/src/library_memfs.js index d3148d8b..95c3ae65 100644 --- a/src/library_memfs.js +++ b/src/library_memfs.js @@ -8,7 +8,7 @@ mergeInto(LibraryManager.library, { CONTENT_FLEXIBLE: 2, // has been modified or never set to anything, and is a flexible js array that can grow/shrink CONTENT_FIXED: 3, // contains some fixed-size content written into it, in a typed array mount: function(mount) { - return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createNode: function(parent, name, mode, dev) { if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { @@ -23,7 +23,6 @@ mergeInto(LibraryManager.library, { setattr: MEMFS.node_ops.setattr, lookup: MEMFS.node_ops.lookup, mknod: MEMFS.node_ops.mknod, - mknod: MEMFS.node_ops.mknod, rename: MEMFS.node_ops.rename, unlink: MEMFS.node_ops.unlink, rmdir: MEMFS.node_ops.rmdir, @@ -185,7 +184,7 @@ mergeInto(LibraryManager.library, { return entries; }, symlink: function(parent, newname, oldpath) { - var node = MEMFS.createNode(parent, newname, 0777 | {{{ cDefine('S_IFLNK') }}}, 0); + var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | {{{ cDefine('S_IFLNK') }}}, 0); node.link = oldpath; return node; }, diff --git a/src/library_sockfs.js b/src/library_sockfs.js index 2028d841..22fd8761 100644 --- a/src/library_sockfs.js +++ b/src/library_sockfs.js @@ -3,7 +3,7 @@ mergeInto(LibraryManager.library, { $SOCKFS__deps: ['$FS', 'mkport'], $SOCKFS: { mount: function(mount) { - return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createSocket: function(family, type, protocol) { var streaming = type == {{{ cDefine('SOCK_STREAM') }}}; diff --git a/src/postamble.js b/src/postamble.js index 382d3117..bb1e334c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -2,19 +2,21 @@ // === Auto-generated postamble setup entry stuff === if (memoryInitializer) { - function applyData(data) { + if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { + var data = Module['readBinary'](memoryInitializer); #if USE_TYPED_ARRAYS == 2 HEAPU8.set(data, STATIC_BASE); #else allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); #endif - } - if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { - applyData(Module['readBinary'](memoryInitializer)); } else { addRunDependency('memory initializer'); Browser.asyncLoad(memoryInitializer, function(data) { - applyData(data); +#if USE_TYPED_ARRAYS == 2 + HEAPU8.set(data, STATIC_BASE); +#else + allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); +#endif removeRunDependency('memory initializer'); }, function(data) { throw 'could not load memory initializer ' + memoryInitializer; diff --git a/src/preamble.js b/src/preamble.js index 1c9de066..27a98422 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -683,6 +683,130 @@ function stringToUTF32(str, outPtr) { Module['stringToUTF32'] = stringToUTF32; function demangle(func) { + var i = 3; + // params, etc. + var basicTypes = { + 'v': 'void', + 'b': 'bool', + 'c': 'char', + 's': 'short', + 'i': 'int', + 'l': 'long', + 'f': 'float', + 'd': 'double', + 'w': 'wchar_t', + 'a': 'signed char', + 'h': 'unsigned char', + 't': 'unsigned short', + 'j': 'unsigned int', + 'm': 'unsigned long', + 'x': 'long long', + 'y': 'unsigned long long', + 'z': '...' + }; + var subs = []; + var first = true; + function dump(x) { + //return; + if (x) Module.print(x); + Module.print(func); + var pre = ''; + for (var a = 0; a < i; a++) pre += ' '; + Module.print (pre + '^'); + } + function parseNested() { + i++; + if (func[i] === 'K') i++; // ignore const + var parts = []; + while (func[i] !== 'E') { + if (func[i] === 'S') { // substitution + i++; + var next = func.indexOf('_', i); + var num = func.substring(i, next) || 0; + parts.push(subs[num] || '?'); + i = next+1; + continue; + } + if (func[i] === 'C') { // constructor + parts.push(parts[parts.length-1]); + i += 2; + continue; + } + var size = parseInt(func.substr(i)); + var pre = size.toString().length; + if (!size || !pre) { i--; break; } // counter i++ below us + var curr = func.substr(i + pre, size); + parts.push(curr); + subs.push(curr); + i += pre + size; + } + i++; // skip E + return parts; + } + function parse(rawList, limit, allowVoid) { // main parser + limit = limit || Infinity; + var ret = '', list = []; + function flushList() { + return '(' + list.join(', ') + ')'; + } + var name; + if (func[i] === 'N') { + // namespaced N-E + name = parseNested().join('::'); + limit--; + if (limit === 0) return rawList ? [name] : name; + } else { + // not namespaced + if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' + var size = parseInt(func.substr(i)); + if (size) { + var pre = size.toString().length; + name = func.substr(i + pre, size); + i += pre + size; + } + } + first = false; + if (func[i] === 'I') { + i++; + var iList = parse(true); + var iRet = parse(true, 1, true); + ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; + } else { + ret = name; + } + paramLoop: while (i < func.length && limit-- > 0) { + //dump('paramLoop'); + var c = func[i++]; + if (c in basicTypes) { + list.push(basicTypes[c]); + } else { + switch (c) { + case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer + case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference + case 'L': { // literal + i++; // skip basic type + var end = func.indexOf('E', i); + var size = end - i; + list.push(func.substr(i, size)); + i += size + 2; // size + 'EE' + break; + } + case 'A': { // array + var size = parseInt(func.substr(i)); + i += size.toString().length; + if (func[i] !== '_') throw '?'; + i++; // skip _ + list.push(parse(true, 1, true)[0] + ' [' + size + ']'); + break; + } + case 'E': break paramLoop; + default: ret += '?' + c; break paramLoop; + } + } + } + if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) + return rawList ? list : ret + flushList(); + } try { // Special-case the entry point, since its name differs from other name mangling. if (func == 'Object._main' || func == '_main') { @@ -696,130 +820,6 @@ function demangle(func) { case 'n': return 'operator new()'; case 'd': return 'operator delete()'; } - var i = 3; - // params, etc. - var basicTypes = { - 'v': 'void', - 'b': 'bool', - 'c': 'char', - 's': 'short', - 'i': 'int', - 'l': 'long', - 'f': 'float', - 'd': 'double', - 'w': 'wchar_t', - 'a': 'signed char', - 'h': 'unsigned char', - 't': 'unsigned short', - 'j': 'unsigned int', - 'm': 'unsigned long', - 'x': 'long long', - 'y': 'unsigned long long', - 'z': '...' - }; - function dump(x) { - //return; - if (x) Module.print(x); - Module.print(func); - var pre = ''; - for (var a = 0; a < i; a++) pre += ' '; - Module.print (pre + '^'); - } - var subs = []; - function parseNested() { - i++; - if (func[i] === 'K') i++; // ignore const - var parts = []; - while (func[i] !== 'E') { - if (func[i] === 'S') { // substitution - i++; - var next = func.indexOf('_', i); - var num = func.substring(i, next) || 0; - parts.push(subs[num] || '?'); - i = next+1; - continue; - } - if (func[i] === 'C') { // constructor - parts.push(parts[parts.length-1]); - i += 2; - continue; - } - var size = parseInt(func.substr(i)); - var pre = size.toString().length; - if (!size || !pre) { i--; break; } // counter i++ below us - var curr = func.substr(i + pre, size); - parts.push(curr); - subs.push(curr); - i += pre + size; - } - i++; // skip E - return parts; - } - var first = true; - function parse(rawList, limit, allowVoid) { // main parser - limit = limit || Infinity; - var ret = '', list = []; - function flushList() { - return '(' + list.join(', ') + ')'; - } - var name; - if (func[i] === 'N') { - // namespaced N-E - name = parseNested().join('::'); - limit--; - if (limit === 0) return rawList ? [name] : name; - } else { - // not namespaced - if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' - var size = parseInt(func.substr(i)); - if (size) { - var pre = size.toString().length; - name = func.substr(i + pre, size); - i += pre + size; - } - } - first = false; - if (func[i] === 'I') { - i++; - var iList = parse(true); - var iRet = parse(true, 1, true); - ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; - } else { - ret = name; - } - paramLoop: while (i < func.length && limit-- > 0) { - //dump('paramLoop'); - var c = func[i++]; - if (c in basicTypes) { - list.push(basicTypes[c]); - } else { - switch (c) { - case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer - case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference - case 'L': { // literal - i++; // skip basic type - var end = func.indexOf('E', i); - var size = end - i; - list.push(func.substr(i, size)); - i += size + 2; // size + 'EE' - break; - } - case 'A': { // array - var size = parseInt(func.substr(i)); - i += size.toString().length; - if (func[i] !== '_') throw '?'; - i++; // skip _ - list.push(parse(true, 1, true)[0] + ' [' + size + ']'); - break; - } - case 'E': break paramLoop; - default: ret += '?' + c; break paramLoop; - } - } - } - if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) - return rawList ? list : ret + flushList(); - } return parse(); } catch(e) { return func; diff --git a/tests/cases/atomicrmw_dec.ll b/tests/cases/atomicrmw_dec.ll new file mode 100644 index 00000000..0ff08a5d --- /dev/null +++ b/tests/cases/atomicrmw_dec.ll @@ -0,0 +1,21 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %t = alloca i32, align 4 ; [#uses=2 type=i32**] + store i32 50, i32* %t, align 4 + %0 = load i32* %t + %1 = atomicrmw sub i32* %t, i32 3 seq_cst ; [#uses=0 type=i32] [debug line = 21:12] + %2 = load i32* %t + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %0, i32 %2) ; [#uses=0 type=i32] + %3 = atomicrmw volatile add i32* %t, i32 3 seq_cst ; [#uses=0 type=i32] [debug line = 21:12] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/atomicrmw_dec.txt b/tests/cases/atomicrmw_dec.txt new file mode 100644 index 00000000..e8dcb406 --- /dev/null +++ b/tests/cases/atomicrmw_dec.txt @@ -0,0 +1 @@ +hello, 50,47! diff --git a/tests/cases/dollar.ll b/tests/cases/dollar.ll new file mode 100644 index 00000000..7d730d6a --- /dev/null +++ b/tests/cases/dollar.ll @@ -0,0 +1,22 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +define void @"dollar$"() { + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] + ret void +} + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + call void ()* @"dollar$"() + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/ptrtoint_blockaddr.ll b/tests/cases/ptrtoint_blockaddr.ll index 68b29300..6adc2c5b 100644 --- a/tests/cases/ptrtoint_blockaddr.ll +++ b/tests/cases/ptrtoint_blockaddr.ll @@ -1,8 +1,12 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] -define linkonce_odr i32* @main() align 2 { - %199 = trunc i8 1 to i1 ; [#uses=1] - br i1 %199, label %label555, label %label569 +define linkonce_odr i32 @main() align 2 { + %a199 = trunc i8 1 to i1 ; [#uses=1] + br i1 %a199, label %label555, label %label569 label555: ; preds = %353 br label %label569 @@ -10,9 +14,9 @@ label555: ; preds = %353 br label %label569 label569: ; preds = %555 - %333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %a333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] ; this should compile ok - store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), align 8 + store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i32* bitcast (i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0) to i32*), align 8 ret i32 0 } diff --git a/tests/fuzz/18.cpp b/tests/fuzz/18.cpp new file mode 100644 index 00000000..b27aac1b --- /dev/null +++ b/tests/fuzz/18.cpp @@ -0,0 +1,1125 @@ +/* + * This is a RANDOMLY GENERATED PROGRAM. + * + * Generator: csmith 2.2.0 + * Git version: bf42ffd + * Options: --no-volatiles --no-packed-struct --lang-cpp + * Seed: 2604553870 + */ + +#include "csmith.h" + + +static long __undefined; + +/* --- Struct/Union Declarations --- */ +struct S0 { + unsigned f0 : 21; + uint8_t f1; + const unsigned f2 : 30; + unsigned f3 : 8; + signed f4 : 13; + unsigned f5 : 5; + unsigned f6 : 18; + unsigned f7 : 3; +}; + +struct S1 { + const int32_t f0; + unsigned f1 : 9; + unsigned f2 : 16; +}; + +struct S2 { + int32_t f0; + int64_t f1; +}; + +/* --- GLOBAL VARIABLES --- */ +static int32_t g_2 = 9L; +static int16_t g_27 = 0x03BEL; +static int16_t g_38 = 6L; +static int16_t *g_37[8][8] = {{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,NULL,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38}}; +static int32_t g_62 = 0x3DA513E6L; +static int32_t *g_61 = &g_62; +static uint16_t g_68 = 0xCE71L; +static uint8_t g_78 = 0x1DL; +static uint32_t g_114 = 0x200BAF9CL; +static struct S2 g_121 = {0x5C255F5DL,-10L}; +static uint64_t g_159 = 0UL; +static uint16_t g_161 = 0x490DL; +static uint8_t g_184 = 8UL; +static uint32_t g_187 = 0x30F3DA43L; +static int32_t g_202 = 0x4816DB70L; +static uint64_t g_203 = 18446744073709551615UL; +static struct S1 g_208 = {0xB9C60537L,10,69}; +static uint32_t g_215 = 0x25330C45L; +static int32_t g_239 = 9L; +static int8_t g_240 = 3L; +static int16_t g_241[4] = {0xD26EL,0xD26EL,0xD26EL,0xD26EL}; +static int64_t g_242 = 7L; +static uint16_t g_244[3] = {65534UL,65534UL,65534UL}; +static struct S2 g_291[4][6] = {{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}},{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}}}; +static uint64_t g_323 = 1UL; +static int64_t *g_379 = &g_242; +static int64_t **g_378[4] = {&g_379,&g_379,&g_379,&g_379}; +static const int32_t *g_385 = &g_291[0][1].f0; +static int32_t g_386[4] = {0L,0L,0L,0L}; +static struct S0 g_408 = {1391,0xFDL,15322,15,20,0,166,1}; +static struct S0 * const g_414 = &g_408; +static struct S0 * const *g_413[3][5] = {{NULL,NULL,&g_414,NULL,NULL},{&g_414,NULL,&g_414,&g_414,NULL},{NULL,&g_414,&g_414,NULL,&g_414}}; +static int32_t g_467 = 0x3F4F500CL; +static uint32_t g_468 = 3UL; +static int32_t g_476 = (-7L); +static uint8_t *g_553 = &g_184; +static uint8_t **g_552[9][3] = {{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553}}; +static int64_t * const **g_561 = NULL; +static int64_t g_565 = 0L; +static uint16_t *g_569 = &g_68; +static uint16_t * const *g_568 = &g_569; +static struct S2 *g_589 = &g_291[0][1]; +static struct S0 g_605 = {1424,0xCBL,22754,10,-53,2,290,0}; +static int8_t g_706 = 8L; +static uint32_t *g_708 = &g_114; +static uint32_t **g_707 = &g_708; +static uint64_t g_721 = 0xC18F15E9DB4D38A5LL; +static uint32_t g_732[5] = {4UL,4UL,4UL,4UL,4UL}; + + +/* --- FORWARD DECLARATIONS --- */ +static uint16_t func_1(void); +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15); +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22); +static struct S0 func_24(const int16_t p_25); +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36); +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42); +static struct S2 func_43(uint64_t p_44, int8_t p_45, int64_t p_46, const int16_t * p_47, int32_t p_48); +static uint64_t func_49(int16_t * p_50, int16_t * p_51, uint8_t p_52); +static int16_t * func_53(uint8_t p_54); +static const int32_t * func_63(uint16_t p_64, uint32_t p_65); + + +/* --- FUNCTIONS --- */ +/* ------------------------------------------ */ +/* + * reads : g_2 g_37 g_38 g_68 g_62 g_78 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 g_291.f0 g_386 g_385 g_184 g_413 g_379 g_240 g_569 g_408.f1 g_565 g_706 g_707 g_568 g_467 g_721 g_732 g_408.f0 g_708 g_476 g_589 g_291 + * writes: g_2 g_27 g_61 g_68 g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 g_385 g_413 g_240 g_552 g_589 g_467 g_241 g_721 g_732 g_476 g_706 + */ +static uint16_t func_1(void) +{ /* block id: 0 */ + int32_t l_23 = 0x5ECCE35AL; + int16_t *l_55 = &g_38; + const int32_t l_409 = (-1L); + int8_t l_740[6]; + struct S0 l_770[6][4] = {{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}},{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}}}; + int i, j; + for (i = 0; i < 6; i++) + l_740[i] = 0L; + for (g_2 = 0; (g_2 >= (-27)); g_2--) + { /* block id: 3 */ + int16_t *l_26 = &g_27; + int32_t l_738[1][3]; + int32_t *l_792[9][5]; + int i, j; + for (i = 0; i < 1; i++) + { + for (j = 0; j < 3; j++) + l_738[i][j] = 0x140016D3L; + } + for (i = 0; i < 9; i++) + { + for (j = 0; j < 5; j++) + l_792[i][j] = &g_291[0][1].f0; + } + l_23 = (safe_mod_func_int32_t_s_s((safe_rshift_func_int16_t_s_s((safe_div_func_int16_t_s_s((0xFDEB7727L != (func_11((safe_mul_func_int8_t_s_s(func_18(l_23, func_24(((*l_26) = 1L)), func_32(g_37[1][3], l_26, func_39(&g_38, func_43(func_49(func_53((NULL != l_55)), &g_38, g_38), g_386[0], l_23, &g_241[2], l_23), l_409), l_738[0][1]), l_740[4]), g_386[2])), l_770[4][1], l_770[4][1].f2, l_738[0][1]) , (*g_385))), l_738[0][1])), l_738[0][0])), l_770[4][1].f0)); + } + return l_740[0]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_589 g_291 g_467 g_208 + * writes: g_291 g_467 + */ +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15) +{ /* block id: 356 */ + int32_t *l_774 = NULL; + int32_t *l_775 = &g_386[3]; + int32_t l_776 = (-4L); + int32_t *l_777 = &g_476; + int32_t *l_778 = &g_386[3]; + int32_t *l_779 = &g_291[0][1].f0; + int32_t *l_780 = &g_467; + int32_t *l_781 = &g_121.f0; + int32_t *l_782 = NULL; + int32_t *l_783 = NULL; + int32_t *l_784 = &g_121.f0; + int32_t *l_785 = &l_776; + int32_t *l_786 = &g_386[3]; + int32_t *l_787 = &g_476; + int32_t *l_788[5]; + uint32_t l_789 = 4294967295UL; + int i; + for (i = 0; i < 5; i++) + l_788[i] = &g_467; + (*g_589) = (*g_589); + for (g_467 = (-24); (g_467 >= (-17)); g_467 = safe_add_func_int16_t_s_s(g_467, 2)) + { /* block id: 360 */ + struct S2 l_773 = {7L,0L}; + (*g_589) = l_773; + } + l_789--; + return g_208; +} + + +/* ------------------------------------------ */ +/* + * reads : g_408.f0 g_708 g_114 g_467 g_476 g_408.f1 g_61 g_386 + * writes: g_476 g_240 g_706 g_62 g_61 + */ +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22) +{ /* block id: 344 */ + int16_t l_743[9] = {(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)}; + int32_t l_752 = (-4L); + int32_t *l_753 = &g_476; + struct S2 **l_758 = &g_589; + int8_t *l_759 = NULL; + int8_t *l_760 = &g_240; + int8_t *l_761 = NULL; + int8_t *l_762 = &g_706; + int32_t l_763[5][9] = {{0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L},{0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L},{0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L},{0x128A5967L,0x30E877D1L,0L,0L,0x30E877D1L,0x128A5967L,0x30E877D1L,0L,0L},{0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L}}; + int32_t *l_764 = &g_62; + uint32_t *l_765[3]; + uint16_t l_766 = 0xF503L; + int32_t **l_769 = &g_61; + int i, j; + for (i = 0; i < 3; i++) + l_765[i] = &g_187; + (*l_764) = (l_763[4][6] = (((safe_add_func_uint16_t_u_u(l_743[0], (!((l_743[6] > ((safe_div_func_uint64_t_u_u((safe_add_func_uint32_t_u_u(l_743[8], (((*l_762) = ((*l_760) = ((safe_lshift_func_int16_t_s_u(((p_21.f3 < (safe_mod_func_int64_t_s_s(((((*l_753) = (l_752 = p_20.f1)) <= (safe_div_func_int8_t_s_s((safe_mod_func_int16_t_s_s(0xB8ECL, (p_20.f2 | ((((g_408.f0 , ((((p_21.f2 , p_21.f0) != (*g_708)) != 0x4E7498EBL) , l_758)) == NULL) , 0L) , 0xBFE5L)))), 0x90L))) != 0xE0L), g_467))) , (*l_753)), 14)) && 65535UL))) & g_408.f1))), 1L)) < l_743[0])) ^ p_20.f2)))) ^ 0L) >= l_743[0])); + (*l_769) = &g_386[2]; + return (**l_769); +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static struct S0 func_24(const int16_t p_25) +{ /* block id: 5 */ + uint8_t l_28 = 1UL; + struct S0 l_31 = {1310,250UL,6302,7,41,3,97,1}; + --l_28; + return l_31; +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36) +{ /* block id: 342 */ + const struct S0 l_739[6][2] = {{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}}}; + int i, j; + return l_739[2][1]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_385 g_62 g_2 g_68 g_184 g_413 g_244 g_208.f0 g_121.f0 g_61 g_114 g_379 g_240 g_291.f0 g_569 g_242 g_121.f1 g_408.f1 g_38 g_241 g_565 g_706 g_707 g_568 g_467 g_721 g_732 + * writes: g_68 g_61 g_184 g_413 g_78 g_121.f0 g_242 g_240 g_215 g_38 g_244 g_552 g_589 g_467 g_241 g_721 g_732 + */ +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42) +{ /* block id: 206 */ + struct S0 *l_412 = &g_408; + struct S0 ** const l_411 = &l_412; + int32_t l_433 = 0x4FB4C694L; + struct S2 l_438 = {-10L,1L}; + int32_t l_485 = 0x47EB926BL; + int32_t l_489 = (-5L); + int32_t l_491 = (-5L); + int32_t l_497[1][2][7] = {{{1L,0x49C8437AL,0x027D64C9L,0x027D64C9L,0x49C8437AL,1L,0x49C8437AL},{0L,1L,1L,0L,0x49C8437AL,0L,1L}}}; + int16_t l_566 = (-6L); + int64_t **l_571 = &g_379; + uint8_t *l_616 = &g_78; + const struct S1 l_690 = {8L,21,198}; + struct S2 *l_701[10][4]; + uint64_t *l_704 = &g_159; + uint64_t **l_703 = &l_704; + uint32_t l_715 = 0x9F38D7D3L; + int32_t l_718 = 0x12E69001L; + int8_t l_719 = 0xD2L; + int32_t *l_724 = &g_121.f0; + int32_t *l_725 = &g_476; + int32_t *l_726[4][7] = {{&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0},{&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491,&g_386[0],&g_476},{&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0},{&l_491,&g_386[0],&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491}}; + int8_t l_727 = 0x0FL; + int32_t l_728 = 0x918BB4DCL; + int8_t l_729 = (-1L); + int64_t l_730 = 0x057B8866389C3D9ALL; + int32_t l_731 = 0x218CCC61L; + uint32_t l_735[3][8] = {{4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL,0x220CCB51L,4294967295UL,0x0F3DCF02L},{0x3C85B5A0L,0x3828014FL,0x3C85B5A0L,0xAB1F2D4FL,0x0F3DCF02L,0x220CCB51L,4294967288UL,4294967288UL},{4294967288UL,0xC3126DF4L,4UL,4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL}}; + int i, j, k; + for (i = 0; i < 10; i++) + { + for (j = 0; j < 4; j++) + l_701[i][j] = &g_121; + } + if ((*g_385)) + { /* block id: 207 */ + const int64_t l_425 = 0L; + int64_t l_445[1][7][8] = {{{6L,0x5503377F6E0C2E72LL,0xDB1D715F2161BBA0LL,8L,0xC2EEBBADC442C092LL,8L,0xDB1D715F2161BBA0LL,0x5503377F6E0C2E72LL},{0L,0xDB1D715F2161BBA0LL,(-1L),8L,0x9650F0EF7A1B8096LL,0xE43D72817AE39055LL,0xE43D72817AE39055LL,0x9650F0EF7A1B8096LL},{(-9L),0x9650F0EF7A1B8096LL,0x9650F0EF7A1B8096LL,(-9L),0L,0x5503377F6E0C2E72LL,0xE43D72817AE39055LL,6L},{0xDB1D715F2161BBA0LL,(-9L),(-1L),0xE43D72817AE39055LL,(-1L),(-9L),0xDB1D715F2161BBA0LL,0xC2EEBBADC442C092LL},{(-1L),(-9L),0xDB1D715F2161BBA0LL,0xC2EEBBADC442C092LL,0x5503377F6E0C2E72LL,0x5503377F6E0C2E72LL,0xC2EEBBADC442C092LL,0xDB1D715F2161BBA0LL},{0x9650F0EF7A1B8096LL,0x9650F0EF7A1B8096LL,(-9L),0L,0x5503377F6E0C2E72LL,0xE43D72817AE39055LL,6L,0xE43D72817AE39055LL},{(-1L),0xDB1D715F2161BBA0LL,0L,0xDB1D715F2161BBA0LL,(-1L),8L,0x9650F0EF7A1B8096LL,0xE43D72817AE39055LL}}}; + int32_t l_456 = 0xF544D161L; + int32_t l_457 = (-3L); + int32_t l_472 = 0x70112BE4L; + int32_t l_473 = (-3L); + int32_t l_474 = (-8L); + int32_t l_482 = 3L; + int32_t l_487 = 0xF8FC29F0L; + int32_t l_488 = 1L; + int32_t l_495 = 0x89F792B4L; + int32_t l_499 = 7L; + int32_t l_501 = 8L; + int32_t l_503[8][4] = {{4L,(-1L),(-1L),4L},{0x45F54343L,0xC77ACF08L,0x5D3F1EBDL,(-1L)},{0xC77ACF08L,0x923204FEL,1L,(-1L)},{(-1L),0x45F54343L,(-1L),(-1L)},{9L,0x923204FEL,9L,(-1L)},{4L,0xC77ACF08L,9L,4L},{(-1L),(-1L),0x5D3F1EBDL,0xC77ACF08L},{(-1L),0x923204FEL,0x5D3F1EBDL,0x5D3F1EBDL}}; + int8_t l_508 = (-1L); + const int64_t *l_537 = &l_438.f1; + const int64_t **l_536 = &l_537; + uint8_t *l_540[1][10] = {{&g_184,&g_184,NULL,&g_184,NULL,&g_184,&g_184,NULL,&g_184,NULL}}; + struct S1 l_567[5] = {{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120}}; + int64_t l_572[6][1][3]; + struct S0 *l_603 = &g_408; + struct S0 *l_618 = &g_605; + int16_t l_624 = 0xB59DL; + int8_t *l_683 = &g_240; + struct S2 **l_700[2][3][2] = {{{&g_589,&g_589},{&g_589,&g_589},{&g_589,&g_589}},{{&g_589,&g_589},{&g_589,&g_589},{&g_589,&g_589}}}; + int16_t *l_702[4][1]; + int8_t *l_705 = &l_508; + int i, j, k; + for (i = 0; i < 6; i++) + { + for (j = 0; j < 1; j++) + { + for (k = 0; k < 3; k++) + l_572[i][j][k] = 0xD283F39FEC0527E5LL; + } + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 1; j++) + l_702[i][j] = &g_241[3]; + } + for (g_68 = 0; (g_68 <= 3); g_68 += 1) + { /* block id: 210 */ + int32_t **l_410 = &g_61; + struct S0 **l_421[3][5] = {{&l_412,&l_412,&l_412,&l_412,&l_412},{&l_412,&l_412,&l_412,&l_412,&l_412},{&l_412,&l_412,&l_412,&l_412,&l_412}}; + struct S1 l_442 = {0x8A5D5689L,10,57}; + uint64_t l_448 = 0x6347FF966CC3914CLL; + int32_t l_471 = 1L; + int32_t l_478 = 8L; + int32_t l_480 = 0xFA8E425CL; + int32_t l_483 = 0x315C4785L; + int32_t l_484 = 0x680B5AEDL; + int32_t l_490 = 0xE692470BL; + int32_t l_496 = 0L; + int32_t l_498 = (-1L); + int32_t l_500 = 0x95A5B8D0L; + int32_t l_502 = 0L; + int32_t l_504 = 0L; + int32_t l_505 = 0x05779FDBL; + int32_t l_506 = 0x918B72A4L; + int32_t l_507 = 0x2EA2263BL; + int32_t l_510 = 0xE311EADEL; + int32_t l_511 = 0x75ECBCB0L; + int32_t l_512 = 0x1C2CC190L; + int32_t l_513 = 0L; + int32_t l_514 = 6L; + int32_t l_515 = 0x0937537CL; + int32_t l_517 = 0x3441E561L; + int32_t l_518 = 0xC823A3FCL; + int32_t l_519 = 0x90011C2FL; + int32_t l_520 = 0x341C22D6L; + int32_t l_521 = 0x5CAAD854L; + int32_t l_522 = (-10L); + int32_t l_523 = 0x049BF5F2L; + int32_t l_524 = (-8L); + uint16_t l_525 = 65535UL; + int64_t ***l_590 = &g_378[0]; + int64_t l_629 = 0x46CA53608441CAF0LL; + int16_t l_677 = 0L; + uint8_t **l_681 = &l_540[0][2]; + int i, j; + (*l_410) = &g_2; + for (g_184 = 0; (g_184 <= 2); g_184 += 1) + { /* block id: 214 */ + struct S0 * const **l_415 = NULL; + struct S0 * const **l_416[6]; + uint8_t *l_424 = &g_78; + int32_t *l_426[2]; + uint64_t *l_462 = &g_159; + uint64_t *l_463 = &g_159; + int16_t l_493 = 0x6E98L; + int8_t l_494 = 0xF3L; + int64_t l_509 = 0xC174661CDA2966DCLL; + int32_t l_516 = 0x5FDB9509L; + int64_t * const l_564 = &g_565; + int64_t * const *l_563 = &l_564; + int64_t * const **l_562[10] = {&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563}; + int8_t *l_601 = &g_240; + struct S0 *l_604[2]; + int32_t * const l_620 = &l_487; + int64_t l_634 = 1L; + struct S2 l_641 = {2L,0L}; + int i; + for (i = 0; i < 6; i++) + l_416[i] = &g_413[0][2]; + for (i = 0; i < 2; i++) + l_426[i] = NULL; + for (i = 0; i < 2; i++) + l_604[i] = &g_605; + g_121.f0 &= ((l_411 != (g_413[1][3] = g_413[0][2])) , (safe_add_func_int8_t_s_s((((safe_div_func_uint8_t_u_u((&l_412 == l_421[1][3]), ((NULL == (*l_411)) && g_244[g_184]))) < (((*l_424) = (((0x12C856C1CC60DBF6LL < (safe_mul_func_uint8_t_u_u((g_244[g_184] | g_208.f0), 0UL))) < 0x8AL) , 255UL)) == l_425)) >= 6UL), 3UL))); + for (g_242 = 0; (g_242 <= 3); g_242 += 1) + { /* block id: 220 */ + int8_t *l_439 = &g_240; + uint16_t *l_440 = &g_244[g_184]; + int32_t l_441 = (-1L); + struct S1 *l_452 = &g_208; + struct S1 **l_451 = &l_452; + int32_t l_475 = 8L; + int32_t l_477 = 0x536BCEFBL; + int32_t l_486[10] = {0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L}; + int16_t l_492 = 0x66BEL; + uint8_t **l_541 = &l_540[0][0]; + uint8_t ***l_554 = &l_541; + int32_t *l_570 = &l_516; + uint32_t * const l_588 = &g_114; + uint32_t * const *l_587[4][9][1] = {{{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588},{NULL},{NULL}},{{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588},{NULL}},{{NULL},{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588}},{{NULL},{NULL},{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588}}}; + int i, j, k; + } + if ((p_42 && (((safe_mod_func_int8_t_s_s(0L, (safe_add_func_int8_t_s_s((**l_410), ((g_114 >= (NULL == (*l_571))) > ((((safe_div_func_int64_t_s_s((((safe_lshift_func_int8_t_s_s((((*l_601) ^= (safe_sub_func_int16_t_s_s((-9L), ((0L <= (p_42 < 4UL)) > p_42)))) == p_41.f0), g_291[0][1].f0)) && (*g_569)) <= 0xD53C66FD4F73076ELL), p_42)) ^ p_41.f0) != 0UL) > 0xF8645B00L)))))) && (*g_379)) , l_489))) + { /* block id: 267 */ + int32_t l_617 = (-7L); + l_495 &= ((safe_unary_minus_func_uint8_t_u((((*l_411) = l_603) != ((((l_604[1] = &g_408) != (((safe_mul_func_int16_t_s_s(((l_617 = ((*l_616) = (safe_mod_func_uint64_t_u_u(((safe_mod_func_uint64_t_u_u((g_121.f1 > (((safe_rshift_func_uint8_t_u_u((p_41.f1 , p_41.f1), ((safe_div_func_int8_t_s_s((!(l_616 == l_540[0][0])), (-1L))) && 4294967291UL))) < p_42) , 0UL)), (*g_379))) != 0xE395B63D813E0CE4LL), l_567[1].f0)))) | (-7L)), (**l_410))) , (**l_410)) , l_603)) & 0xE7L) , l_618)))) == p_41.f0); + } + else + { /* block id: 273 */ + int8_t l_619 = 1L; + int32_t l_622 = 0x58D90218L; + int32_t l_627[3][2][3] = {{{0x6C7084D8L,1L,1L},{(-2L),0x656137AFL,(-2L)}},{{0x6C7084D8L,0x6C7084D8L,1L},{0xC42365C0L,0x656137AFL,0xC42365C0L}},{{0x6C7084D8L,1L,1L},{(-2L),0x656137AFL,(-2L)}}}; + int16_t l_630 = 0x0383L; + uint64_t l_631 = 2UL; + int i, j, k; + if ((*g_61)) + { /* block id: 274 */ + return p_40; + } + else + { /* block id: 276 */ + if (l_619) + break; + } + for (g_215 = 0; (g_215 <= 3); g_215 += 1) + { /* block id: 281 */ + int32_t **l_621 = &g_61; + int32_t l_623 = 1L; + int32_t l_625 = 0x55945757L; + int32_t l_626 = (-10L); + int32_t l_628[7][6] = {{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)}}; + int i, j; + (*l_621) = l_620; + l_631--; + } + p_41.f0 &= (l_634 , (*g_385)); + } + (*l_620) = (((g_408.f1 , (safe_div_func_int8_t_s_s((&g_385 == &g_61), (l_501 = 5L)))) >= (safe_mul_func_uint16_t_u_u((((**l_410) , (-9L)) || ((((((safe_mod_func_uint16_t_u_u(((l_641 , (**l_410)) != p_41.f0), p_42)) ^ (*p_40)) & 0x0CL) || 1UL) , (-3L)) >= 1L)), (*p_40)))) ^ 248UL); + } + for (l_472 = 3; (l_472 >= 0); l_472 -= 1) + { /* block id: 292 */ + int i; + if (g_241[g_68]) + break; + for (l_624 = 0; (l_624 >= 0); l_624 -= 1) + { /* block id: 296 */ + int16_t *l_657[8][5][6] = {{{&g_38,&g_38,&g_38,NULL,&g_38,NULL},{&g_241[0],NULL,&g_241[3],NULL,&l_624,&g_241[g_68]},{&g_38,&g_38,&g_241[0],NULL,NULL,&g_241[3]},{NULL,&g_241[0],&g_241[3],NULL,NULL,NULL},{NULL,NULL,&l_624,&g_241[g_68],&g_241[0],&g_241[2]}},{{&g_241[2],NULL,&g_241[g_68],NULL,&g_38,NULL},{&g_38,&g_241[g_68],&g_241[3],NULL,&g_38,NULL},{&g_38,NULL,&g_38,&l_566,&g_241[3],&g_38},{NULL,NULL,&g_241[3],&g_241[3],NULL,NULL},{&g_38,&l_624,&g_241[3],&g_38,NULL,&g_241[3]}},{{NULL,NULL,&g_241[3],NULL,&g_241[3],&l_624},{&g_241[g_68],&l_624,NULL,NULL,&l_566,&l_624},{&l_624,NULL,&l_566,NULL,NULL,&g_38},{NULL,&l_566,&g_241[3],&g_241[0],NULL,&l_624},{&g_241[1],&g_241[3],NULL,&g_38,NULL,NULL}},{{NULL,&g_241[0],NULL,&g_38,&l_624,NULL},{NULL,&g_38,&l_566,&l_566,&g_241[0],NULL},{&g_241[2],&g_38,&g_241[3],&l_624,&g_38,&g_241[2]},{&g_241[0],&l_624,&g_241[2],&g_241[3],&g_241[2],&l_624},{NULL,&g_241[3],NULL,&g_241[2],&g_38,&g_241[3]}},{{&g_38,NULL,&g_241[2],&g_241[g_68],&g_38,NULL},{NULL,NULL,NULL,&l_566,&g_38,NULL},{&l_624,&g_241[3],&g_241[g_68],NULL,&g_241[2],NULL},{NULL,&l_624,NULL,NULL,&g_38,&g_241[3]},{&l_624,&g_38,&g_38,&l_566,&g_241[0],&g_38}},{{NULL,&g_38,&g_38,NULL,&l_624,&l_566},{&g_241[2],&g_241[0],&g_241[3],NULL,NULL,NULL},{&g_241[3],&g_241[3],NULL,NULL,NULL,&g_241[g_68]},{NULL,&l_566,&g_241[g_68],NULL,NULL,&g_241[g_68]},{NULL,NULL,&l_624,&g_38,&l_566,NULL}},{{&g_241[g_68],&l_624,NULL,&g_241[0],&g_241[0],&l_624},{&g_241[0],&g_241[g_68],NULL,NULL,NULL,NULL},{&l_566,NULL,&l_624,NULL,&l_624,&g_241[g_68]},{NULL,&l_624,&g_241[g_68],&l_624,&g_241[g_68],&g_241[g_68]},{NULL,&g_241[3],NULL,NULL,&g_241[3],NULL}},{{&g_241[3],&g_241[3],&g_241[3],NULL,&g_241[g_68],&l_566},{&l_566,NULL,&g_38,NULL,&g_38,&g_38},{&g_241[0],&g_241[0],&g_38,&g_241[g_68],NULL,&g_241[3]},{&g_241[g_68],NULL,NULL,NULL,&g_241[2],NULL},{&g_241[g_68],&l_624,&g_241[g_68],&g_241[3],NULL,NULL}}}; + uint16_t *l_674 = NULL; + uint16_t *l_675 = &g_244[0]; + int i, j, k; + if (l_497[l_624][(l_624 + 1)][(l_472 + 2)]) + break; + if ((1UL ^ ((0UL >= (safe_add_func_int32_t_s_s((safe_mod_func_int8_t_s_s((l_457 = ((safe_mod_func_uint16_t_u_u(0xE961L, (safe_sub_func_uint16_t_u_u((safe_mul_func_uint8_t_u_u((safe_lshift_func_uint16_t_u_u((l_497[l_624][(l_624 + 1)][(l_472 + 2)] != (((*p_40) = (0xA3B3L | (0x1353L ^ 4L))) && (g_408.f1 < ((*l_616) = p_41.f0)))), 6)), l_495)), g_241[g_68])))) , 0x84L)), p_41.f0)), 0x07DE3AA1L))) <= 0x6467FAD3L))) + { /* block id: 301 */ + const uint16_t *l_655 = &g_244[2]; + const uint16_t **l_654 = &l_655; + const uint16_t ***l_656 = &l_654; + (*l_656) = l_654; + return &g_241[3]; + } + else + { /* block id: 304 */ + int i, j, k; + l_497[l_624][l_624][(g_68 + 2)] = (&g_378[3] == &l_571); + if (l_438.f1) + continue; + (*l_410) = (*l_410); + } + if ((safe_rshift_func_uint16_t_u_u(((*l_675) = (((safe_div_func_uint8_t_u_u(252UL, l_474)) && (3UL ^ (((*p_40) & (safe_rshift_func_int8_t_s_s((+(l_497[l_624][(l_624 + 1)][(l_472 + 2)] || ((safe_rshift_func_uint8_t_u_s((safe_mul_func_int8_t_s_s((safe_add_func_int64_t_s_s((0UL == (safe_mul_func_uint8_t_u_u(((*g_569) , ((safe_sub_func_uint16_t_u_u((3L > l_497[0][0][2]), l_485)) & g_241[g_68])), p_41.f0))), l_438.f1)), p_41.f1)), p_41.f0)) , 255UL))), g_565))) < 0x23L))) || l_488)), l_474))) + { /* block id: 310 */ + return p_40; + } + else + { /* block id: 312 */ + int32_t *l_676 = &l_512; + (*l_676) |= 0xC60B90E3L; + if (l_677) + continue; + } + for (l_485 = 3; (l_485 >= 0); l_485 -= 1) + { /* block id: 318 */ + uint8_t ***l_680 = &g_552[0][2]; + int32_t *l_682[10] = {&l_499,&l_488,&l_499,&l_499,&l_488,&l_499,&l_499,&l_488,&l_499,&l_499}; + int i; + l_490 = (safe_div_func_uint16_t_u_u((((*l_680) = &g_553) == l_681), (-5L))); + } + } + } + } + g_467 |= (((*l_683) = 0x75L) >= ((safe_mul_func_uint16_t_u_u(((safe_rshift_func_int16_t_s_u((safe_add_func_int32_t_s_s((l_690 , ((((((safe_add_func_int8_t_s_s(((*l_705) = (((safe_div_func_int32_t_s_s((safe_unary_minus_func_int64_t_s(((((safe_lshift_func_int16_t_s_s((l_499 |= ((*p_40) = (safe_sub_func_int32_t_s_s((*g_385), ((g_589 = (l_701[2][1] = &g_291[0][1])) != &g_291[1][3]))))), 5)) || l_438.f0) == ((-8L) < (((((p_41.f0 && p_42) & g_242) && 65533UL) >= p_41.f0) ^ 0x0575L))) || (*g_385)))), 0x74555EFDL)) , l_703) != NULL)), p_41.f1)) && g_706) >= 1UL) , (uint32_t**) NULL) == g_707) | p_41.f0)), p_41.f1)), (*g_569))) ^ (**g_568)), 0xD444L)) | 0x2E5CL)); + return &g_241[3]; + } + else + { /* block id: 333 */ + int32_t *l_709 = &g_386[0]; + int32_t *l_710 = &g_291[0][1].f0; + int32_t *l_711 = &g_386[0]; + int32_t *l_712[10] = {&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476}; + int8_t l_713[2][10] = {{8L,8L,8L,8L,8L,8L,8L,8L,8L,8L},{8L,8L,8L,8L,8L,8L,8L,8L,8L,8L}}; + int8_t l_714 = (-4L); + int8_t l_720 = 0x74L; + int i, j; + for (g_242 = 0; g_242 < 4; g_242 += 1) + { + g_241[g_242] = 0xA2BAL; + } + ++l_715; + --g_721; + } + p_41.f0 |= p_42; + ++g_732[4]; + --l_735[1][1]; + return p_40; +} + + +/* ------------------------------------------ */ +/* + * reads : g_187 g_61 g_2 g_291.f0 g_121 + * writes: g_242 g_68 g_291 g_203 + */ +static struct S2 func_43(uint64_t p_44, int8_t p_45, int64_t p_46, const int16_t * p_47, int32_t p_48) +{ /* block id: 199 */ + struct S1 *l_389[8] = {&g_208,&g_208,&g_208,&g_208,&g_208,&g_208,&g_208,&g_208}; + struct S2 *l_396 = &g_121; + uint16_t *l_399 = &g_161; + uint64_t *l_402 = &g_203; + int32_t l_403[3][3] = {{0x065366F1L,0x065366F1L,0x065366F1L},{(-1L),(-1L),(-1L)},{0x065366F1L,0x065366F1L,0x065366F1L}}; + int64_t l_404 = 0x9AD62FCB4E69716BLL; + int32_t *l_405 = &g_291[0][1].f0; + struct S0 *l_407 = &g_408; + struct S0 **l_406 = &l_407; + int i, j; + for (g_242 = 0; g_242 < 4; g_242 += 1) + { + for (g_68 = 0; g_68 < 6; g_68 += 1) + { + struct S2 tmp = {0xF74DE0BBL,0xE77EDE5556FB1F53LL}; + g_291[g_242][g_68] = tmp; + } + } + (*l_405) ^= (safe_mul_func_uint16_t_u_u(p_45, (!((&g_208 == l_389[7]) > ((l_403[0][0] = ((safe_rshift_func_int8_t_s_u((safe_mul_func_uint16_t_u_u((safe_mul_func_int16_t_s_s((l_396 != NULL), (safe_div_func_uint64_t_u_u(((NULL == l_399) , ((*l_402) = (l_389[7] == ((safe_add_func_int8_t_s_s(0x0DL, g_187)) , l_389[7])))), l_403[2][1])))), l_404)), l_403[2][1])) , (*g_61))) , 9UL))))); + (*l_406) = NULL; + return g_121; +} + + +/* ------------------------------------------ */ +/* + * reads : g_2 g_68 g_62 g_78 g_38 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 g_291.f0 + * writes: g_61 g_68 g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 g_385 + */ +static uint64_t func_49(int16_t * p_50, int16_t * p_51, uint8_t p_52) +{ /* block id: 10 */ + int32_t *l_57 = &g_2; + int32_t **l_58 = NULL; + int32_t *l_60 = &g_2; + int32_t **l_59[1]; + uint16_t *l_66 = NULL; + uint16_t *l_67 = &g_68; + const int32_t *l_384 = &g_291[0][1].f0; + const int32_t **l_383[7] = {&l_384,&l_384,&l_384,&l_384,&l_384,&l_384,&l_384}; + int i; + for (i = 0; i < 1; i++) + l_59[i] = &l_60; + g_61 = (l_57 = l_57); + g_385 = func_63(((*l_67) ^= g_2), g_62); + g_291[0][1].f0 &= 0x21F51DF0L; + return g_208.f2; +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static int16_t * func_53(uint8_t p_54) +{ /* block id: 8 */ + int16_t *l_56 = NULL; + return l_56; +} + + +/* ------------------------------------------ */ +/* + * reads : g_78 g_68 g_62 g_2 g_38 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 + * writes: g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_68 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 + */ +static const int32_t * func_63(uint16_t p_64, uint32_t p_65) +{ /* block id: 14 */ + int32_t *l_69 = NULL; + int32_t **l_70 = &l_69; + int32_t l_91 = 0xE8BE9C2CL; + uint16_t **l_98 = NULL; + uint8_t l_223 = 1UL; + uint8_t *l_237 = &g_184; + int32_t l_267 = 0x50EEFC11L; + uint32_t l_268 = 0x089C4C44L; + uint8_t l_305 = 255UL; + int32_t l_356 = (-1L); + int32_t l_358 = 0x1ABD8A15L; + uint32_t l_375 = 0xAF36EF52L; + int64_t ***l_380 = &g_378[3]; + int64_t **l_382 = &g_379; + int64_t ***l_381 = &l_382; +lbl_190: + (*l_70) = l_69; + if ((safe_rshift_func_int16_t_s_u(p_64, 10))) + { /* block id: 16 */ + uint16_t *l_85[1]; + int32_t l_89 = (-6L); + struct S2 l_122[6] = {{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL}}; + struct S1 l_136 = {0L,20,34}; + uint8_t *l_163 = &g_78; + struct S1 *l_207 = &g_208; + struct S1 *l_247 = &g_208; + int i; + for (i = 0; i < 1; i++) + l_85[i] = &g_68; + if (p_64) + { /* block id: 17 */ + uint8_t *l_77 = &g_78; + uint16_t *l_83[2][1][1]; + uint16_t **l_84 = &l_83[1][0][0]; + int32_t l_88 = 1L; + int32_t *l_90 = NULL; + int i, j, k; + for (i = 0; i < 2; i++) + { + for (j = 0; j < 1; j++) + { + for (k = 0; k < 1; k++) + l_83[i][j][k] = NULL; + } + } + l_91 &= ((+(65535UL == ((~((safe_div_func_int16_t_s_s((((safe_div_func_int8_t_s_s(p_64, (+((((((*l_77)--) <= (safe_rshift_func_uint8_t_u_s((((*l_84) = l_83[1][0][0]) == l_85[0]), 4))) < p_64) & (g_68 <= g_62)) , ((safe_rshift_func_int16_t_s_u((g_2 ^ g_38), p_64)) & l_88))))) == (*g_61)) | p_64), l_89)) , g_62)) ^ p_65))) , p_65); + if (p_64) + { /* block id: 21 */ + int32_t *l_92 = &g_62; + int32_t *l_93 = &l_89; + (*l_93) = ((*l_92) |= l_89); + } + else + { /* block id: 24 */ + return &g_2; + } + } + else + { /* block id: 27 */ + uint32_t *l_113 = &g_114; + int32_t l_115 = 1L; + struct S2 l_126 = {0x3EC0817FL,-8L}; + uint8_t *l_151 = &g_78; + int16_t *l_182[3]; + int32_t l_221 = 0xB19B034DL; + int32_t l_222 = 1L; + int32_t *l_236[6][4][8] = {{{&l_89,&l_126.f0,&l_221,&l_89,&g_62,NULL,&l_126.f0,&l_126.f0},{&l_122[5].f0,&g_62,NULL,NULL,&g_62,&l_122[5].f0,&l_115,&l_122[5].f0},{&l_89,&l_115,&l_91,&l_126.f0,&l_122[5].f0,&l_91,&g_62,&l_91},{&l_222,&l_126.f0,&l_126.f0,&l_126.f0,&l_222,&l_126.f0,&l_126.f0,&l_122[5].f0}},{{&l_89,&l_222,&l_122[5].f0,NULL,&l_126.f0,&l_89,&l_89,&l_126.f0},{&l_89,&l_122[5].f0,&l_122[5].f0,&l_89,&l_115,&l_91,&l_126.f0,&l_122[5].f0},{&l_126.f0,&g_62,&l_126.f0,&l_122[5].f0,&g_62,&l_221,&g_62,&l_122[5].f0},{&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0,&l_91,&l_115,&l_89}},{{&l_222,&l_122[5].f0,NULL,&l_126.f0,&l_89,&l_89,&l_126.f0,NULL},{&l_222,&l_222,&l_221,&l_122[5].f0,&l_126.f0,&l_126.f0,&l_222,&l_126.f0},{&l_91,&l_126.f0,&l_122[5].f0,&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0},{&l_126.f0,&l_115,NULL,&l_122[5].f0,&l_115,&l_122[5].f0,&g_62,NULL}},{{&l_89,&g_62,NULL,&l_126.f0,&l_126.f0,NULL,&g_62,&l_89},{&l_89,&l_126.f0,NULL,&l_122[5].f0,&l_222,&l_89,&l_122[5].f0,&l_122[5].f0},{&l_222,&l_89,&l_122[5].f0,&l_122[5].f0,&l_122[5].f0,&l_89,&l_222,&l_122[5].f0},{&l_89,&l_126.f0,&l_221,&l_89,&g_62,NULL,&l_126.f0,&l_126.f0}},{{&l_122[5].f0,&g_62,NULL,NULL,&g_62,&l_122[5].f0,&l_115,&l_122[5].f0},{&l_89,&l_115,&l_126.f0,&l_91,NULL,&l_126.f0,&l_89,&l_126.f0},{&l_122[5].f0,&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0,&l_91,&l_115},{&l_221,&l_122[5].f0,NULL,&g_2,&l_91,&l_221,&l_221,&l_91}},{{NULL,NULL,NULL,NULL,&l_126.f0,&l_126.f0,&l_91,NULL},{&l_91,&l_89,&g_62,&l_115,&l_89,&l_89,&l_89,&l_115},{&l_126.f0,&l_89,&l_126.f0,NULL,&l_91,&l_126.f0,&l_126.f0,NULL},{&l_122[5].f0,NULL,&g_2,&l_91,&l_221,&l_221,&l_91,&g_2}}}; + struct S1 **l_248 = &l_207; + int i, j, k; + for (i = 0; i < 3; i++) + l_182[i] = &g_38; + if ((g_62 ^ (!((safe_sub_func_int64_t_s_s((~(l_115 = (g_62 , ((safe_lshift_func_int16_t_s_s((NULL == l_98), (safe_rshift_func_uint16_t_u_s(((((*l_113) ^= (safe_mul_func_int16_t_s_s((0x3A24L >= (-6L)), (safe_rshift_func_uint16_t_u_s((safe_lshift_func_int8_t_s_s(p_64, 1)), ((l_89 = (safe_mod_func_int16_t_s_s((safe_sub_func_int32_t_s_s(0L, (safe_lshift_func_uint16_t_u_s((0x2F0D9F09L & 1UL), 4)))), p_64))) ^ g_68)))))) != 0xC0EDEAE2L) == g_2), p_64)))) || g_2)))), p_65)) & p_65)))) + { /* block id: 31 */ + int32_t *l_116 = NULL; + int16_t l_160 = 1L; + int32_t l_166 = 4L; + struct S2 l_179 = {0x56559E35L,7L}; + int32_t *l_185 = NULL; + int32_t *l_186[6][6][5] = {{{&g_121.f0,&g_121.f0,NULL,&l_166,NULL},{&l_89,&g_62,NULL,&l_89,&l_179.f0},{NULL,&l_122[5].f0,&l_89,NULL,NULL},{NULL,&g_62,&l_89,&g_62,NULL},{&l_89,&g_121.f0,&l_122[5].f0,NULL,&g_121.f0},{NULL,&l_115,&g_121.f0,&g_62,NULL}},{{NULL,&l_166,NULL,&g_121.f0,&g_121.f0},{&l_89,&g_62,&l_89,&l_89,NULL},{&g_121.f0,&l_122[5].f0,NULL,&g_121.f0,NULL},{&l_126.f0,&l_122[5].f0,&l_89,&g_62,&l_179.f0},{&l_89,NULL,NULL,NULL,NULL},{&l_179.f0,&l_115,&l_89,&g_62,NULL}},{{&l_166,NULL,NULL,NULL,&l_166},{&l_89,&l_122[5].f0,&g_121.f0,&l_89,&l_126.f0},{&l_166,&l_122[5].f0,&l_122[5].f0,&l_166,NULL},{&l_179.f0,&g_62,&l_89,&l_122[5].f0,&l_126.f0},{&l_89,&l_166,&l_89,NULL,&l_166},{&l_126.f0,&l_115,NULL,&l_122[5].f0,NULL}},{{&g_121.f0,&g_121.f0,NULL,&l_166,NULL},{&l_89,&g_62,NULL,&l_89,&l_179.f0},{NULL,&l_122[5].f0,&l_89,NULL,NULL},{NULL,&g_62,&l_89,&g_62,NULL},{&l_89,&g_121.f0,&l_122[5].f0,NULL,&g_121.f0},{NULL,&l_115,&g_121.f0,&g_62,NULL}},{{NULL,&l_166,NULL,&g_121.f0,&g_121.f0},{&l_89,&g_62,&l_89,&l_89,NULL},{&g_121.f0,&l_122[5].f0,NULL,&g_121.f0,NULL},{&l_126.f0,NULL,&l_126.f0,&l_115,NULL},{&l_115,NULL,&l_126.f0,&l_126.f0,NULL},{NULL,NULL,&l_89,&l_89,NULL}},{{&l_122[5].f0,NULL,&g_121.f0,NULL,&l_122[5].f0},{&l_89,NULL,&l_89,NULL,&l_89},{&l_122[5].f0,NULL,NULL,&l_122[5].f0,&l_126.f0},{NULL,&l_115,&l_126.f0,NULL,&l_89},{&l_115,&l_122[5].f0,&l_115,&l_126.f0,&l_122[5].f0},{&l_89,NULL,NULL,NULL,NULL}}}; + int i, j, k; + g_62 &= (g_68 , p_65); + for (g_38 = (-4); (g_38 < 27); g_38++) + { /* block id: 35 */ + for (g_114 = (-27); (g_114 != 17); ++g_114) + { /* block id: 38 */ + uint32_t l_123 = 4294967286UL; + struct S2 *l_127 = &l_122[1]; + l_122[5] = g_121; + ++l_123; + (*l_127) = (g_114 , l_126); + } + } + for (g_121.f1 = 0; (g_121.f1 >= 14); g_121.f1 = safe_add_func_int64_t_s_s(g_121.f1, 3)) + { /* block id: 46 */ + int8_t l_157 = 0L; + int8_t l_162 = 1L; + struct S1 l_170 = {0x613543D0L,20,166}; + for (g_121.f0 = 0; (g_121.f0 <= 27); ++g_121.f0) + { /* block id: 49 */ + uint8_t l_134[1]; + int32_t *l_135 = &l_91; + int i; + for (i = 0; i < 1; i++) + l_134[i] = 0x73L; + (*l_135) = (g_62 = ((safe_rshift_func_int16_t_s_s(0x5A5DL, 8)) <= l_134[0])); + } + if ((l_136 , (*g_61))) + { /* block id: 53 */ + (*l_70) = &g_2; + } + else + { /* block id: 55 */ + uint32_t l_156 = 4294967286UL; + uint64_t *l_158 = &g_159; + int32_t *l_164 = NULL; + int32_t *l_165 = &l_91; + int8_t *l_169 = &l_162; + const int16_t *l_173[5][6][8] = {{{&l_160,&g_38,&l_160,&l_160,NULL,NULL,NULL,NULL},{&l_160,&l_160,&l_160,&l_160,&g_38,&l_160,&l_160,&l_160},{NULL,&g_38,&l_160,&l_160,&g_38,&g_38,&l_160,&g_38},{&g_38,&g_38,&g_38,&l_160,&g_38,&l_160,&g_38,&g_38},{&l_160,&l_160,NULL,&g_38,&g_38,NULL,&l_160,&l_160},{&l_160,&g_38,&g_38,NULL,&l_160,&l_160,&l_160,&g_38}},{{&g_38,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160,&g_38},{&l_160,&g_38,&l_160,&g_38,&l_160,NULL,&g_38,&g_38},{&l_160,&l_160,&l_160,&g_38,&g_38,&g_38,&g_38,&l_160},{&l_160,&g_38,&l_160,&g_38,&l_160,&l_160,&g_38,&g_38},{&g_38,&l_160,NULL,&l_160,&g_38,&l_160,&g_38,&g_38},{&g_38,&l_160,NULL,NULL,&g_38,NULL,NULL,&l_160}},{{&g_38,&l_160,&g_38,&l_160,&g_38,&l_160,&l_160,NULL},{&g_38,&l_160,&g_38,&g_38,&g_38,&g_38,&l_160,&g_38},{&l_160,&g_38,&g_38,&l_160,NULL,&g_38,NULL,&g_38},{NULL,&g_38,NULL,&g_38,&l_160,&l_160,&g_38,&l_160},{NULL,&g_38,NULL,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&l_160,&l_160,&l_160,&g_38,&g_38,NULL}},{{&l_160,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160,&l_160},{&g_38,&l_160,&g_38,&g_38,NULL,&g_38,&l_160,&l_160},{NULL,&g_38,&g_38,&l_160,NULL,&l_160,&g_38,&l_160},{&g_38,&g_38,NULL,NULL,&l_160,&g_38,&l_160,&l_160},{&l_160,&g_38,&g_38,&g_38,&g_38,&l_160,&g_38,NULL},{&l_160,&l_160,&g_38,&l_160,&l_160,NULL,&g_38,&g_38}},{{NULL,&g_38,&g_38,&l_160,&l_160,&g_38,&g_38,NULL},{&l_160,&l_160,&g_38,&g_38,&g_38,&l_160,&g_38,&l_160},{&l_160,&g_38,&l_160,NULL,NULL,&g_38,&g_38,&l_160},{&l_160,&l_160,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160},{&g_38,&g_38,&g_38,&g_38,&l_160,&l_160,&l_160,&l_160},{&l_160,&l_160,&l_160,&g_38,&l_160,&l_160,&g_38,&g_38}}}; + uint8_t *l_183[3][2][3] = {{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}},{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}},{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}}}; + int i, j, k; + l_166 |= (l_126 , ((*l_165) ^= (((safe_mod_func_uint8_t_u_u((+(&g_78 == ((safe_add_func_int32_t_s_s((safe_mul_func_uint8_t_u_u(((-1L) & (p_65 > (l_162 = (~(g_161 = (g_68 = (((safe_rshift_func_int8_t_s_s((+(safe_mod_func_uint16_t_u_u(l_126.f1, ((((*l_158) = ((((safe_rshift_func_uint16_t_u_u((((*l_113) = (l_151 != ((((func_24((((safe_mod_func_int16_t_s_s((l_156 = ((safe_rshift_func_uint8_t_u_s(p_64, (~0x5FL))) > 0L)), p_64)) || 0xCC89D979L) <= 0x3E2DD196261E54E0LL)) , l_126.f0) | 0x1E0ADED1L) | l_157) , (uint8_t*) NULL))) != 7UL), l_126.f0)) | l_126.f1) & (*g_61)) & p_64)) & 0x0FC352BBFD28FE82LL) | g_121.f0)))), p_64)) & 0xCEC0L) || l_160))))))), 0xACL)), l_136.f0)) , l_163))), l_157)) , &g_2) != &g_62))); + l_122[5].f0 |= ((*l_165) ^= (safe_add_func_int8_t_s_s(((*l_169) = g_159), (((~(l_170 , (0xDCF4L | (safe_div_func_uint8_t_u_u((((l_89 = ((*l_163) = (l_173[2][1][1] != ((safe_unary_minus_func_uint64_t_u(((safe_div_func_uint32_t_u_u((safe_div_func_uint32_t_u_u((l_179 , (p_64 & l_115)), (0xD642D507L | ((safe_mul_func_uint8_t_u_u((g_159 != 0xE52791890F00B84BLL), 255UL)) ^ p_65)))), l_89)) <= p_65))) , l_182[2])))) , p_65) , p_65), p_65))))) && 0xDB16BE7C8CA683B8LL) > g_68)))); + } + } + g_187++; + } + else + { /* block id: 72 */ + uint16_t l_191 = 1UL; + if (g_187) + goto lbl_190; + l_191 = 7L; + } + for (g_159 = 0; (g_159 <= 0); g_159 += 1) + { /* block id: 78 */ + int32_t *l_192 = &l_91; + uint32_t l_218 = 0xF747F287L; + int32_t *l_219 = &l_126.f0; + int32_t *l_220[8][10][3] = {{{NULL,&g_2,&l_89},{&l_91,&l_91,&l_115},{&g_2,&l_89,NULL},{NULL,&l_91,&l_115},{&l_126.f0,&g_121.f0,&l_89},{&l_122[5].f0,&l_126.f0,&l_91},{&l_115,NULL,&l_115},{&l_89,NULL,&l_89},{&l_89,&g_2,&l_122[5].f0},{&g_2,NULL,&l_126.f0}},{{NULL,&l_115,&g_2},{&l_91,&l_89,NULL},{NULL,NULL,NULL},{&g_2,&l_91,&g_121.f0},{&l_89,&g_121.f0,&l_91},{&l_89,NULL,NULL},{&l_115,NULL,&g_62},{&l_122[5].f0,NULL,&l_89},{&l_126.f0,&l_89,&l_89},{NULL,NULL,&l_91}},{{&g_2,&l_89,&g_2},{&l_91,NULL,&g_121.f0},{NULL,NULL,NULL},{NULL,NULL,&l_122[5].f0},{&g_121.f0,&g_121.f0,&l_115},{&g_62,&l_91,&l_126.f0},{&l_115,NULL,&l_91},{&g_121.f0,NULL,NULL},{&l_89,&g_2,&l_91},{&l_91,&l_91,NULL}},{{&l_122[5].f0,NULL,&g_2},{&g_121.f0,NULL,NULL},{&l_89,&g_121.f0,&l_89},{&l_126.f0,&g_62,&l_89},{&l_91,&l_115,NULL},{&l_122[5].f0,&g_121.f0,&l_122[5].f0},{&g_2,NULL,NULL},{&l_122[5].f0,NULL,NULL},{&l_91,&g_62,NULL},{&l_126.f0,&l_91,&l_89}},{{&l_89,NULL,NULL},{&g_121.f0,&g_121.f0,&l_91},{&l_122[5].f0,&g_121.f0,&l_89},{&l_91,NULL,&l_122[5].f0},{&l_89,&l_115,&g_62},{&g_121.f0,NULL,&g_62},{&g_2,&g_121.f0,&l_89},{&g_121.f0,&g_121.f0,NULL},{&l_115,NULL,NULL},{&l_91,&l_91,&g_121.f0}},{{&l_122[5].f0,&g_62,NULL},{&g_121.f0,NULL,NULL},{&g_62,NULL,&l_89},{&l_126.f0,&g_121.f0,NULL},{&g_2,&l_115,NULL},{&l_115,&g_62,&g_121.f0},{&g_2,&g_121.f0,NULL},{NULL,NULL,NULL},{&g_2,NULL,&l_89},{NULL,&l_91,&g_62}},{{&l_115,&g_2,&g_62},{&g_121.f0,NULL,&l_122[5].f0},{&l_115,&l_126.f0,&l_89},{NULL,&l_122[5].f0,&l_91},{&g_2,&l_115,NULL},{NULL,&l_89,&l_89},{&g_2,&l_89,NULL},{&l_115,&g_2,NULL},{&g_2,NULL,NULL},{&l_126.f0,&l_91,&l_122[5].f0}},{{&g_62,NULL,NULL},{&g_121.f0,&g_2,&l_89},{&l_122[5].f0,&l_89,&l_89},{&l_91,&l_89,NULL},{&l_115,&l_115,&g_2},{&g_121.f0,&l_122[5].f0,NULL},{&g_2,&l_126.f0,&l_91},{&g_121.f0,NULL,NULL},{&l_89,&g_2,&l_91},{&l_91,&l_91,NULL}}}; + int i, j, k; + g_121.f0 ^= l_89; + for (g_121.f1 = 0; (g_121.f1 <= 2); g_121.f1 += 1) + { /* block id: 82 */ + int16_t l_193 = 7L; + int32_t *l_194 = &g_62; + int32_t *l_195 = &l_115; + int32_t *l_196 = &l_115; + int32_t *l_197 = &l_89; + int32_t l_198 = 1L; + int32_t *l_199 = &l_89; + int32_t l_200 = 0xEA293CA1L; + int32_t *l_201[5][8] = {{&l_198,NULL,&l_89,&l_115,&l_115,&l_89,NULL,&l_198},{NULL,&l_126.f0,&l_198,&g_2,&l_198,&l_126.f0,NULL,NULL},{&l_126.f0,&g_2,&l_89,&l_89,&g_2,&l_126.f0,&l_115,&l_126.f0},{&g_2,&l_126.f0,&l_115,&l_126.f0,&g_2,&l_89,&l_115,&l_89},{NULL,&g_2,&g_2,NULL,&l_91,&l_89,&l_91,NULL}}; + int i, j; + (*l_70) = l_192; + g_203--; + if (l_126.f1) + break; + } + for (l_126.f1 = 0; (l_126.f1 >= 0); l_126.f1 -= 1) + { /* block id: 89 */ + int64_t l_209 = (-1L); + for (l_126.f0 = 0; (l_126.f0 <= 0); l_126.f0 += 1) + { /* block id: 92 */ + (*l_192) ^= 0xDC3F510EL; + (*l_70) = NULL; + } + for (g_161 = 0; (g_161 <= 5); g_161 += 1) + { /* block id: 98 */ + int32_t *l_206 = &l_126.f0; + int i; + (*l_70) = l_206; + l_122[(l_126.f1 + 1)] = l_122[(l_126.f1 + 4)]; + l_207 = NULL; + if (p_65) + continue; + } + for (g_121.f1 = 0; (g_121.f1 <= 2); g_121.f1 += 1) + { /* block id: 106 */ + int32_t *l_210 = &l_122[5].f0; + int32_t *l_211 = &l_115; + int32_t *l_212 = &l_115; + int32_t *l_213 = NULL; + int32_t *l_214[2]; + int i; + for (i = 0; i < 2; i++) + l_214[i] = &l_89; + g_215++; + if (l_218) + break; + (*l_211) = p_65; + } + } + --l_223; + } + if (((safe_div_func_int16_t_s_s((((+p_65) > ((-6L) || (safe_div_func_uint64_t_u_u(p_64, (safe_rshift_func_int8_t_s_s(((l_122[5].f0 = ((safe_mul_func_int16_t_s_s((safe_rshift_func_uint8_t_u_u(((l_91 = l_122[5].f0) , (&g_184 != (l_237 = l_163))), ((l_89 = ((safe_unary_minus_func_int8_t_s(g_38)) && (&g_208 != NULL))) < 0xE523L))), 0x8B00L)) >= p_64)) || p_64), p_65)))))) <= 0L), 9UL)) >= g_161)) + { /* block id: 118 */ + l_91 = (p_64 & (-1L)); + } + else + { /* block id: 120 */ + int8_t l_243 = (-1L); + --g_244[2]; + } + (*l_248) = l_247; + } + } + else + { /* block id: 125 */ + int16_t l_254 = 0xC2D8L; + int32_t l_258 = 3L; + struct S1 *l_298[4][3] = {{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208}}; + uint16_t l_306 = 0UL; + uint32_t *l_307 = NULL; + int32_t l_308 = (-7L); + uint16_t l_359 = 0x98FFL; + int i, j; + for (g_121.f0 = 0; (g_121.f0 <= 3); g_121.f0 += 1) + { /* block id: 128 */ + uint32_t *l_253 = &g_114; + int32_t *l_255 = &l_91; + int32_t *l_256 = NULL; + int32_t *l_257 = &l_91; + int32_t *l_259 = &l_258; + int32_t *l_260 = &l_91; + int32_t *l_261 = &g_62; + int32_t *l_262 = &g_62; + int32_t l_263[4][10][6] = {{{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L}},{{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L}},{{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L},{(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL,(-1L)}},{{3L,(-1L),0x2A09282DL,0x240811FDL,0x2A09282DL,(-1L)},{0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L,0x44646C51L},{0x2A09282DL,0x2A09282DL,0x1456EAE4L,0x240811FDL,2L,0x240811FDL},{3L,0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L},{(-1L),3L,3L,(-1L),0x2A09282DL,0x240811FDL},{0x240811FDL,(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L},{(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL,(-1L)},{3L,(-1L),0x2A09282DL,0x240811FDL,0x2A09282DL,(-1L)},{0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L,0x44646C51L},{0x2A09282DL,0x2A09282DL,0x1456EAE4L,0x240811FDL,2L,0x240811FDL}}}; + int32_t *l_264 = &l_91; + int32_t *l_265 = &l_91; + int32_t *l_266[3]; + int64_t *l_280[8][3] = {{&g_121.f1,&g_121.f1,&g_121.f1},{NULL,&g_242,&g_242},{&g_121.f1,&g_242,NULL},{NULL,NULL,NULL},{&g_121.f1,&g_121.f1,NULL},{&g_121.f1,&g_121.f1,&g_242},{NULL,&g_121.f1,&g_121.f1},{&g_242,NULL,NULL}}; + uint16_t *l_283[9][10] = {{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68}}; + int i, j, k; + for (i = 0; i < 3; i++) + l_266[i] = &l_91; + l_254 = ((safe_rshift_func_uint8_t_u_u((g_184 = (((*l_253) &= (safe_rshift_func_int8_t_s_s(g_202, 2))) > 0x48EA2435L)), p_65)) <= 1L); + l_268--; + (*l_259) = (!p_64); + (*l_265) = ((((1UL || ((((safe_sub_func_uint64_t_u_u(0x55E803D2FD9BEF9FLL, (safe_add_func_int32_t_s_s((0x1127L != (safe_mod_func_uint64_t_u_u((((((0xF7L > (safe_unary_minus_func_int8_t_s(p_65))) && ((safe_div_func_uint64_t_u_u(18446744073709551615UL, (g_242 = (-1L)))) , (safe_lshift_func_uint16_t_u_s((l_258 = 0x8659L), (safe_mul_func_uint16_t_u_u(((g_121 , (int16_t*) NULL) != NULL), p_64)))))) && 3UL) > g_2) & (*l_265)), 1L))), 0x307B5E04L)))) , (*l_260)) , p_65) <= l_254)) , p_65) <= p_64) <= p_65); + for (g_187 = 0; (g_187 <= 3); g_187 += 1) + { /* block id: 139 */ + uint8_t l_286[9][1][3] = {{{255UL,2UL,255UL}},{{0x71L,246UL,0x12L}},{{246UL,246UL,255UL}},{{0x12L,255UL,255UL}},{{255UL,0x71L,2UL}},{{0x12L,0x71L,0x12L}},{{246UL,255UL,2UL}},{{246UL,246UL,255UL}},{{0x12L,255UL,255UL}}}; + int i, j, k; + for (g_215 = 0; (g_215 <= 3); g_215 += 1) + { /* block id: 142 */ + int i; + for (g_68 = 0; (g_68 <= 3); g_68 += 1) + { /* block id: 145 */ + l_286[7][0][1]--; + } + for (p_65 = 2; (p_65 <= 8); p_65 += 1) + { /* block id: 150 */ + struct S2 *l_289 = NULL; + struct S2 *l_290 = &g_291[0][1]; + (*l_290) = g_121; + if (p_64) + goto lbl_190; + } + for (g_161 = 0; (g_161 <= 3); g_161 += 1) + { /* block id: 156 */ + return &g_2; + } + if (g_241[g_187]) + continue; + } + } + } + l_258 = p_64; + if (((safe_mul_func_uint8_t_u_u((((!((safe_mul_func_uint8_t_u_u((p_65 | ((!(safe_rshift_func_uint8_t_u_u(((-3L) | (p_64 || (&g_208 == l_298[3][2]))), 5))) && g_242)), (((safe_mod_func_uint16_t_u_u((l_308 = (safe_mul_func_uint16_t_u_u(((l_258 |= (safe_mod_func_int8_t_s_s((-1L), ((p_65 != ((p_65 | l_305) , 0x0DA34F26F14F79CFLL)) || l_306)))) , g_159), 0L))), (-1L))) , g_208) , p_65))) <= p_64)) & 1L) > 0x66L), 5L)) && 0UL)) + { /* block id: 166 */ + uint32_t **l_315 = &l_307; + struct S2 l_320 = {0x97D02AEDL,0xD98A267DB47F5A99LL}; + uint64_t *l_321 = NULL; + uint64_t *l_322 = &g_159; + uint16_t *l_324 = &g_161; + l_258 = (safe_mod_func_int32_t_s_s(((!(safe_add_func_uint16_t_u_u(g_203, ((p_65 == (safe_mul_func_int8_t_s_s(((((((((((p_65 != (((*l_315) = &g_114) == NULL)) , ((*l_324) = (((*l_237) = (safe_mul_func_int16_t_s_s((g_68 != ((safe_mod_func_int32_t_s_s((g_208.f2 && ((*l_322) = ((l_320 , (l_320.f1 > 1L)) || g_2))), g_121.f0)) >= (*g_61))), g_323))) & 0xD4L))) <= g_2) || (-2L)) , 0xF4L) & 255UL) , 1L) & p_65) , 0xFE222A196B499643LL) && p_65), p_64))) , p_64)))) , 0x7C957AF7L), (-1L))); + } + else + { /* block id: 172 */ + uint32_t *l_329[8] = {NULL,&l_268,&l_268,NULL,&l_268,&l_268,NULL,&l_268}; + int32_t l_349 = 2L; + int32_t l_357 = 0x3309E014L; + struct S2 l_362 = {0L,-4L}; + int i; + for (g_215 = 0; (g_215 != 12); ++g_215) + { /* block id: 175 */ + int32_t l_332 = 0x995CAD86L; + uint32_t *l_333 = &g_215; + struct S2 l_334[8][3] = {{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}}}; + struct S2 *l_335 = &g_291[0][5]; + int32_t *l_336 = &l_258; + int32_t *l_337 = &l_332; + int32_t *l_338 = &l_258; + int32_t *l_339 = &l_267; + int32_t *l_340 = &l_308; + int32_t *l_341 = &g_62; + int32_t *l_342 = NULL; + int32_t *l_343 = &l_267; + int32_t *l_344 = &l_267; + int32_t *l_345 = &l_308; + int32_t *l_346 = &l_332; + int32_t *l_347 = &g_291[0][1].f0; + int32_t *l_348 = NULL; + int32_t *l_350 = &l_332; + int32_t *l_351 = &l_258; + int32_t *l_352 = &g_291[0][1].f0; + int32_t *l_353 = &g_291[0][1].f0; + int32_t *l_354 = &g_62; + int32_t *l_355[7]; + int i, j; + for (i = 0; i < 7; i++) + l_355[i] = &l_334[1][0].f0; + (*l_335) = (g_208 , (((((safe_add_func_int64_t_s_s(g_242, (1L || p_65))) | (l_329[7] == ((((safe_sub_func_int8_t_s_s((~g_208.f0), (+l_258))) > ((p_65 ^ l_332) , 3UL)) , g_121.f0) , l_333))) || g_215) <= l_332) , l_334[1][0])); + ++l_359; + (*l_335) = l_362; + } + for (l_306 = 0; (l_306 >= 25); ++l_306) + { /* block id: 182 */ + return &g_62; + } + return &g_2; + } + for (g_323 = 0; (g_323 < 1); g_323 = safe_add_func_uint8_t_u_u(g_323, 5)) + { /* block id: 189 */ + int32_t *l_367 = &g_62; + int32_t *l_368 = NULL; + int32_t l_369 = 0x32767108L; + int32_t *l_370 = &l_258; + int32_t *l_371 = &l_356; + int32_t *l_372 = &l_258; + int32_t *l_373 = &g_291[0][1].f0; + int32_t *l_374[4]; + int i; + for (i = 0; i < 4; i++) + l_374[i] = &l_308; + --l_375; + } + } + (*l_381) = ((*l_380) = g_378[3]); + return &g_2; +} + + + + +/* ---------------------------------------- */ +int main (int argc, char* argv[]) +{ + int i, j; + int print_hash_value = 0; + if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1; + platform_main_begin(); + crc32_gentab(); + func_1(); + transparent_crc(g_2, "g_2", print_hash_value); + transparent_crc(g_27, "g_27", print_hash_value); + transparent_crc(g_38, "g_38", print_hash_value); + transparent_crc(g_62, "g_62", print_hash_value); + transparent_crc(g_68, "g_68", print_hash_value); + transparent_crc(g_78, "g_78", print_hash_value); + transparent_crc(g_114, "g_114", print_hash_value); + transparent_crc(g_121.f0, "g_121.f0", print_hash_value); + transparent_crc(g_121.f1, "g_121.f1", print_hash_value); + transparent_crc(g_159, "g_159", print_hash_value); + transparent_crc(g_161, "g_161", print_hash_value); + transparent_crc(g_184, "g_184", print_hash_value); + transparent_crc(g_187, "g_187", print_hash_value); + transparent_crc(g_202, "g_202", print_hash_value); + transparent_crc(g_203, "g_203", print_hash_value); + transparent_crc(g_208.f0, "g_208.f0", print_hash_value); + transparent_crc(g_208.f1, "g_208.f1", print_hash_value); + transparent_crc(g_208.f2, "g_208.f2", print_hash_value); + transparent_crc(g_215, "g_215", print_hash_value); + transparent_crc(g_239, "g_239", print_hash_value); + transparent_crc(g_240, "g_240", print_hash_value); + for (i = 0; i < 4; i++) + { + transparent_crc(g_241[i], "g_241[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_242, "g_242", print_hash_value); + for (i = 0; i < 3; i++) + { + transparent_crc(g_244[i], "g_244[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 6; j++) + { + transparent_crc(g_291[i][j].f0, "g_291[i][j].f0", print_hash_value); + transparent_crc(g_291[i][j].f1, "g_291[i][j].f1", print_hash_value); + if (print_hash_value) printf("index = [%d][%d]\n", i, j); + + } + } + transparent_crc(g_323, "g_323", print_hash_value); + for (i = 0; i < 4; i++) + { + transparent_crc(g_386[i], "g_386[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_408.f0, "g_408.f0", print_hash_value); + transparent_crc(g_408.f1, "g_408.f1", print_hash_value); + transparent_crc(g_408.f2, "g_408.f2", print_hash_value); + transparent_crc(g_408.f3, "g_408.f3", print_hash_value); + transparent_crc(g_408.f4, "g_408.f4", print_hash_value); + transparent_crc(g_408.f5, "g_408.f5", print_hash_value); + transparent_crc(g_408.f6, "g_408.f6", print_hash_value); + transparent_crc(g_408.f7, "g_408.f7", print_hash_value); + transparent_crc(g_467, "g_467", print_hash_value); + transparent_crc(g_468, "g_468", print_hash_value); + transparent_crc(g_476, "g_476", print_hash_value); + transparent_crc(g_565, "g_565", print_hash_value); + transparent_crc(g_605.f0, "g_605.f0", print_hash_value); + transparent_crc(g_605.f1, "g_605.f1", print_hash_value); + transparent_crc(g_605.f2, "g_605.f2", print_hash_value); + transparent_crc(g_605.f3, "g_605.f3", print_hash_value); + transparent_crc(g_605.f4, "g_605.f4", print_hash_value); + transparent_crc(g_605.f5, "g_605.f5", print_hash_value); + transparent_crc(g_605.f6, "g_605.f6", print_hash_value); + transparent_crc(g_605.f7, "g_605.f7", print_hash_value); + transparent_crc(g_706, "g_706", print_hash_value); + transparent_crc(g_721, "g_721", print_hash_value); + for (i = 0; i < 5; i++) + { + transparent_crc(g_732[i], "g_732[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value); + return 0; +} + +/************************ statistics ************************* +XXX max struct depth: 1 +breakdown: + depth: 0, occurrence: 213 + depth: 1, occurrence: 18 +XXX total union variables: 0 + +XXX non-zero bitfields defined in structs: 9 +XXX zero bitfields defined in structs: 0 +XXX const bitfields defined in structs: 1 +XXX volatile bitfields defined in structs: 0 +XXX structs with bitfields in the program: 19 +breakdown: + indirect level: 0, occurrence: 8 + indirect level: 1, occurrence: 7 + indirect level: 2, occurrence: 4 +XXX full-bitfields structs in the program: 0 +breakdown: +XXX times a bitfields struct's address is taken: 18 +XXX times a bitfields struct on LHS: 0 +XXX times a bitfields struct on RHS: 15 +XXX times a single bitfield on LHS: 0 +XXX times a single bitfield on RHS: 14 + +XXX max expression depth: 40 +breakdown: + depth: 1, occurrence: 150 + depth: 2, occurrence: 38 + depth: 4, occurrence: 3 + depth: 7, occurrence: 1 + depth: 15, occurrence: 1 + depth: 18, occurrence: 3 + depth: 19, occurrence: 1 + depth: 21, occurrence: 3 + depth: 22, occurrence: 1 + depth: 23, occurrence: 1 + depth: 24, occurrence: 1 + depth: 25, occurrence: 3 + depth: 31, occurrence: 1 + depth: 33, occurrence: 1 + depth: 34, occurrence: 1 + depth: 35, occurrence: 1 + depth: 40, occurrence: 1 + +XXX total number of pointers: 223 + +XXX times a variable address is taken: 543 +XXX times a pointer is dereferenced on RHS: 51 +breakdown: + depth: 1, occurrence: 34 + depth: 2, occurrence: 17 +XXX times a pointer is dereferenced on LHS: 78 +breakdown: + depth: 1, occurrence: 78 +XXX times a pointer is compared with null: 11 +XXX times a pointer is compared with address of another variable: 4 +XXX times a pointer is compared with another pointer: 3 +XXX times a pointer is qualified to be dereferenced: 3931 + +XXX max dereference level: 2 +breakdown: + level: 0, occurrence: 0 + level: 1, occurrence: 316 + level: 2, occurrence: 69 +XXX number of pointers point to pointers: 42 +XXX number of pointers point to scalars: 163 +XXX number of pointers point to structs: 18 +XXX percent of pointers has null in alias set: 23.3 +XXX average alias set size: 1.38 + +XXX times a non-volatile is read: 508 +XXX times a non-volatile is write: 276 +XXX times a volatile is read: 0 +XXX times read thru a pointer: 0 +XXX times a volatile is write: 0 +XXX times written thru a pointer: 0 +XXX times a volatile is available for access: 0 +XXX percentage of non-volatile access: 100 + +XXX forward jumps: 0 +XXX backward jumps: 2 + +XXX stmts: 141 +XXX max block depth: 5 +breakdown: + depth: 0, occurrence: 30 + depth: 1, occurrence: 13 + depth: 2, occurrence: 19 + depth: 3, occurrence: 25 + depth: 4, occurrence: 21 + depth: 5, occurrence: 33 + +XXX percentage a fresh-made variable is used: 17.8 +XXX percentage an existing variable is used: 82.2 +FYI: the random generator makes assumptions about the integer size. See platform.info for more details. +********************* end of statistics **********************/ + diff --git a/tests/fuzz/18.cpp.txt b/tests/fuzz/18.cpp.txt new file mode 100644 index 00000000..33a07e9f --- /dev/null +++ b/tests/fuzz/18.cpp.txt @@ -0,0 +1 @@ +checksum = C536CE7C diff --git a/tests/fuzz/creduce_tester.py b/tests/fuzz/creduce_tester.py index d5618c2e..6bf9473f 100755 --- a/tests/fuzz/creduce_tester.py +++ b/tests/fuzz/creduce_tester.py @@ -34,7 +34,7 @@ except Exception, e: print '4) Compile JS-ly and compare' def try_js(args): - shared.check_execute([shared.EMCC] + EMCC_ARGS + CSMITH_CFLAGS + args + + shared.check_execute([shared.PYTHON, shared.EMCC] + EMCC_ARGS + CSMITH_CFLAGS + args + [filename, '-o', js_filename]) js = shared.run_js(js_filename, stderr=PIPE, engine=ENGINE) assert correct == js diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py index 23b46188..ad5a7021 100755 --- a/tests/fuzz/csmith_driver.py +++ b/tests/fuzz/csmith_driver.py @@ -89,7 +89,7 @@ while 1: def try_js(args): shared.try_delete(filename + '.js') print '(compile)' - shared.check_execute([shared.EMCC, opts, fullname, '-o', filename + '.js'] + CSMITH_CFLAGS + args) + shared.check_execute([shared.PYTHON, shared.EMCC, opts, fullname, '-o', filename + '.js'] + CSMITH_CFLAGS + args) assert os.path.exists(filename + '.js') print '(run)' js = shared.run_js(filename + '.js', stderr=PIPE, engine=engine1, check_timeout=True) @@ -115,7 +115,7 @@ while 1: print "EMSCRIPTEN BUG" notes['embug'] += 1 fails += 1 - shutil.copyfile(fullname, 'newfail%d.c' % fails) + shutil.copyfile(fullname, 'newfail%d%s' % (fails, suffix)) continue #if not ok: # try: # finally, try with safe heap. if that is triggered, this is nonportable code almost certainly diff --git a/tests/fuzz/test.sh b/tests/fuzz/test.sh index af00e966..7e6b8966 100755 --- a/tests/fuzz/test.sh +++ b/tests/fuzz/test.sh @@ -45,4 +45,7 @@ diff fc-sh js | grep -v warning echo "native/fc" grep -v warning fc > fclean diff n1 fclean | grep -v warning +echo "native2/fc" +grep -v warning fc > fclean +diff n2 fclean | grep -v warning diff --git a/tests/fuzz/testpp.sh b/tests/fuzz/testpp.sh new file mode 100755 index 00000000..8e9f4185 --- /dev/null +++ b/tests/fuzz/testpp.sh @@ -0,0 +1,51 @@ +# e.g. +# ~/Dev/emscripten/tests/fuzz$ CSMITH=~/Dev/csmith/src/csmith CSMITH_PATH=~/Dev/csmith python ./csmith_driver.py +# to find failures, then check those out with this script + +echo "builds" +rm *.out *.bc *.js +g++ $@ -I/home/alon/Dev/csmith/runtime -o n1.out &> /dev/null +/home/alon/Dev/fastcomp/build/Release/bin/clang++ $@ -I/home/alon/Dev/csmith/runtime -o n2.out &> /dev/null +/home/alon/Dev/fastcomp/build/Release/bin/clang++ $@ -I/home/alon/Dev/csmith/runtime -emit-llvm -c -o bc.bc &> o +~/Dev/emscripten/em++ $@ -I/home/alon/Dev/csmith/runtime -o js.out.js &> /dev/null +~/Dev/emscripten/em++ $@ -s UNALIGNED_MEMORY=1 -I/home/alon/Dev/csmith/runtime -o ua.out.js &> /dev/null +~/Dev/emscripten/em++ $@ -s SAFE_HEAP=1 -I/home/alon/Dev/csmith/runtime -o sh.out.js &> /dev/null +EMCC_FAST_COMPILER=1 ~/Dev/emscripten/em++ $@ -I/home/alon/Dev/csmith/runtime -o fc.out.js &> /dev/null +EMCC_FAST_COMPILER=1 ~/Dev/emscripten/em++ $@ -s SAFE_HEAP=1 -I/home/alon/Dev/csmith/runtime -o fc-sh.out.js &> /dev/null +echo "run n1" +./n1.out &> n1 +echo "run n2" +./n2.out &> n2 +echo "run bc" +/home/alon/Dev/fastcomp/build/Release/bin/lli bc.bc &> bc +echo "run js" +mozjs js.out.js &> js +echo "run ua" +mozjs ua.out.js &> ua +echo "run sh" +mozjs sh.out.js &> sh +echo "run fc" +mozjs fc.out.js &> fc +echo "run fc-sh" +mozjs fc-sh.out.js &> fc-sh +echo "n/n" +diff n1 n2 +echo "n/bc" +diff n1 bc +echo "n/js" +diff n1 js | grep -v warning +echo "n/js-ua" +diff n1 ua | grep -v warning +echo "n/js-sh" +diff n1 sh | grep -v warning +echo "js/fc" +diff fc js | grep -v warning +echo "js/fc-sh" +diff fc-sh js | grep -v warning +echo "native/fc" +grep -v warning fc > fclean +diff n1 fclean | grep -v warning +echo "native2/fc" +grep -v warning fc > fclean +diff n2 fclean | grep -v warning + diff --git a/tests/printf/output.txt b/tests/printf/output.txt index a3baed28..14e053f6 100644 --- a/tests/printf/output.txt +++ b/tests/printf/output.txt @@ -8281,4 +8281,5 @@ ffffff8000000000 1 1.234568E+04 +1.234568E+04 no_new_line diff --git a/tests/printf/test.c b/tests/printf/test.c index adeb69db..c83d92b0 100644 --- a/tests/printf/test.c +++ b/tests/printf/test.c @@ -8286,6 +8286,7 @@ int main() { printf("%x\n", -0xFFFFFFFF); printf("\n"); printf("%*.*E\n", 10, -1, 12345.6789123); + printf("%*.*E\n", 10, -313, 12345.6789123); printf("no_new_line"); return 0; } diff --git a/tests/test_browser.py b/tests/test_browser.py index ddd70362..c2dbf49b 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1540,7 +1540,7 @@ keydown(100);keyup(100); // trigger the end self.btest('gles2_conformance.cpp', args=['-s', 'GL_ASSERTIONS=1'], expected=['1']) def test_matrix_identity(self): - self.btest('gl_matrix_identity.c', expected=['-1882984448', '460451840'], args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('gl_matrix_identity.c', expected=['-1882984448', '460451840', '1588195328'], args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cubegeom_pre(self): self.btest('cubegeom_pre.c', reference='cubegeom_pre.png', args=['-s', 'LEGACY_GL_EMULATION=1']) diff --git a/tests/test_core.py b/tests/test_core.py index 1a22bab3..b96cbc36 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2080,8 +2080,6 @@ def process(filename): ''', args=['34962', '26214', '35040']) def test_indirectbr(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - Building.COMPILER_TEST_OPTS = filter(lambda x: x != '-g', Building.COMPILER_TEST_OPTS) test_path = path_from_root('tests', 'core', 'test_indirectbr') @@ -2090,8 +2088,6 @@ def process(filename): self.do_run_from_file(src, output) def test_indirectbr_many(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - if Settings.USE_TYPED_ARRAYS != 2: return self.skip('blockaddr > 255 requires ta2') test_path = path_from_root('tests', 'core', 'test_indirectbr_many') @@ -5133,7 +5129,7 @@ def process(filename): 'structparam', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', 'funcptr', # invalid ir 'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs '2xi40', # pnacl limitations in ExpandGetElementPtr - 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME + 'quoted', # current fastcomp limitations FIXME 'sillyfuncast2', 'sillybitcast', 'atomicrmw_unaligned' # TODO XXX ]: continue if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2: @@ -5181,12 +5177,14 @@ def process(filename): def run_all(x): print x - for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')): + for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')) + glob.glob(path_from_root('tests', 'fuzz', '*.cpp')): #if os.path.basename(name) != '4.c': continue + if 'newfail' in name: continue + if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') == '1': continue # works only in fastcomp print name self.do_run(open(path_from_root('tests', 'fuzz', name)).read(), - open(path_from_root('tests', 'fuzz', name + '.txt')).read(), force_c=True) + open(path_from_root('tests', 'fuzz', name + '.txt')).read(), force_c=name.endswith('.c')) run_all('normal') diff --git a/tests/test_sanity.py b/tests/test_sanity.py index cc0819a7..894f2192 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -3,7 +3,7 @@ from runner import RunnerCore, path_from_root from tools.shared import * SANITY_FILE = CONFIG_FILE + '_sanity' -commands = [[EMCC], [PYTHON, path_from_root('tests', 'runner.py'), 'blahblah']] +commands = [[PYTHON, EMCC], [PYTHON, path_from_root('tests', 'runner.py'), 'blahblah']] def restore(): shutil.copyfile(CONFIG_FILE + '_backup', CONFIG_FILE) @@ -51,7 +51,7 @@ class sanity(RunnerCore): if type(command) is not list: command = [command] if expected is None: - if command[0] == EMCC: + if command[0] == EMCC or (len(command) >= 2 and command[1] == EMCC): expected = 'no input files' else: expected = "No tests found for ['blahblah']" @@ -421,12 +421,12 @@ fi restore() def ensure_cache(): - self.do([EMCC, '-O2', path_from_root('tests', 'hello_world.c')]) + self.do([PYTHON, EMCC, '-O2', path_from_root('tests', 'hello_world.c')]) # Manual cache clearing ensure_cache() assert os.path.exists(EMCC_CACHE) - output = self.do([EMCC, '--clear-cache']) + output = self.do([PYTHON, EMCC, '--clear-cache']) assert ERASING_MESSAGE in output assert not os.path.exists(EMCC_CACHE) @@ -436,7 +436,7 @@ fi try: os.environ['LLVM'] = 'waka' assert os.path.exists(EMCC_CACHE) - output = self.do([EMCC]) + output = self.do([PYTHON, EMCC]) assert ERASING_MESSAGE in output assert not os.path.exists(EMCC_CACHE) finally: @@ -594,7 +594,7 @@ fi temp_dir = tempfile.mkdtemp(prefix='emscripten_temp_') os.chdir(temp_dir) - self.do([EMCC, '-O2', '--em-config', custom_config_filename, path_from_root('tests', 'hello_world.c')]) + self.do([PYTHON, EMCC, '-O2', '--em-config', custom_config_filename, path_from_root('tests', 'hello_world.c')]) result = run_js('a.out.js') # Clean up created temp files. diff --git a/tools/make_minigzip.py b/tools/make_minigzip.py index 0c96457b..cc097a6e 100644 --- a/tools/make_minigzip.py +++ b/tools/make_minigzip.py @@ -9,5 +9,5 @@ zlib = shared.Building.build_library('zlib', shared.EMSCRIPTEN_TEMP_DIR, shared. print 'Building minigzip' -Popen(['python2', shared.EMCC, '-O2', shared.path_from_root('tests', 'zlib', 'minigzip.c'), zlib, '-o', shared.path_from_root('tools', 'minigzip.js')]).communicate() +Popen([shared.PYTHON, shared.EMCC, '-O2', shared.path_from_root('tests', 'zlib', 'minigzip.c'), zlib, '-o', shared.path_from_root('tools', 'minigzip.js')]).communicate() |