# HG changeset patch # User Tomas Lindquist Olsen # Date 1236104327 -3600 # Node ID 01544da4cdd8313444f9b49f0c2bc98cccd3aaa6 # Parent 4c524d80e6e184364ed6234430eb984e35b776e4 Added ~{memory} clobber when a jump_target is generated in inline asm (branch out of inline asm) diff -r 4c524d80e6e1 -r 01544da4cdd8 gen/asmstmt.cpp --- a/gen/asmstmt.cpp Tue Mar 03 19:03:27 2009 +0100 +++ b/gen/asmstmt.cpp Tue Mar 03 19:18:47 2009 +0100 @@ -594,6 +594,7 @@ // setup variable for output from asm outSetterStmt->out_c = "=*m,"; outSetterStmt->out.push_back(jump_target); + asmblock->clobs.insert("~{memory},"); asmblock->s.push_back(outSetterStmt); } diff -r 4c524d80e6e1 -r 01544da4cdd8 gen/toir.cpp --- a/gen/toir.cpp Tue Mar 03 19:03:27 2009 +0100 +++ b/gen/toir.cpp Tue Mar 03 19:18:47 2009 +0100 @@ -2593,7 +2593,11 @@ STUB(SymbolExp); #endif -#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) {error("non-const expression '%s' or const Exp type "#x" not implemented", toChars()); fatal(); return NULL; } +#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) { \ + error("expression '%s' is not a constant", toChars()); \ + fatal(); \ + return NULL; \ +} CONSTSTUB(Expression); CONSTSTUB(GEPExp); CONSTSTUB(SliceExp); @@ -2761,9 +2765,10 @@ void obj_includelib(const char* lib) { - char *arg = (char *)mem.malloc(64); + size_t n = strlen(lib)+3; + char *arg = (char *)mem.malloc(n); strcpy(arg, "-l"); - strncat(arg, lib, 64); + strncat(arg, lib, n); global.params.linkswitches->push(arg); }