I have written a simple stack based virtual machine you can view it's source at https://github.com/radinParsaei/VM
when I compile it with clang it works well but if it compiles with GCC in bytecodes I have coded like pop() / pop() it work irregular and it returns stack[stack.size() - 2] / stack[stack.size() - 1] i fix this with writing that code like Value a = pop(); Value b = pop(); return a / b; anyone has better idea?
gcc app runs irregularly but clang works fine
85 Views Asked by radinParsaei At
1
There are 1 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in GCC
- gcc static library compilation
- Different behavior of async with Visual Studio 2013(Windows8.1) and GCC 4.9(Ubuntu14.10)
- How to add directories to Cygwin gcc default search path
- Usage of #ifndef directive
- Failure to link a program with gcc -static
- Text as parameter in inline assembly (ARM)?
- Alternatives for strrspn and strfind functions(libgen functions in Solaris) in AIX?
- Incorrect format specifier with gcc compiler
- Why should I use a closing bracket in this?
- How can I compile *without* various instruction sets enabled?
- Automatically wrap C/C++ function at compile-time with annotation
- gcc compiled library: can successfully link with, how come it's "undefined symbol" when run the program?
- compiling caffe on Yosemite
- error - /usr/bin/ld: cannot find -lavutil in ubuntu 15.04
- Compatibility of libstdc++.so libgcc_s.so when upgrading GCC 4.1 to GCC 4.8.2
Related Questions in G++
- Using std::vector<> and std::shared_ptr<> should cause error
- C++ string and char* manipulation acting weird
- Seg fault when trying to compile PhantomJS from source on CentOS 7
- There is a way in gcc to get a warning when a constexpr can't be evaluated at compile time?
- GCC expected template-name before ‘<’ token error
- C++ What determines which version of C++ can run on a specific architecture (like Arduino)
- C++ unsigned long doesn't wrap around after 4294967295
- Exception not caught on -O2
- Relationship between gcc, g++, cygwin, and wingw?
- Getting unexpected "undefined reference to" errors when compiling with a static library
- SIGSEGV with std::map of pointers to template objects
- OpenGl XUbuntu 14.04 glShaderSource, glCompileShader, glCreateProgram functions not declared
- g++: error: unrecognized command line option ‘-stdlib=libstdc++’
- OpenMP support on OpenBSD
- Is it possible to merge coverage data from two executables with gcov/gcovr?
Related Questions in STACK-BASED
- Is stack-based instruction set one of the most important factors affect java's performance?
- Stack based array declaration in Objective-C?
- gcc app runs irregularly but clang works fine
- Stack Based Virtual Machine - do compiled functions have their own "space"?
- Stack-Based Languages: Pros/Cons of a Register?
- Building a web application with Factor
- Why are register-based virtual machines better than stack-based ones?
- Necessity of the 'rot' operator
- System Error:An Overrun of a stack-based buffer in windows system file explorer.exe
- How would a register + stack based virtual machine work?
- I need C++ array class template, which is fixed-size, stack-based and doesn't require default constructor
- .NET MSIL: How commands detect size of operands?
- Stack cookie instrumentation code detected a stack-based buffer overrun - Fixed
- something like stackbased objects in c++ for javascript
- How would I go about Implementing A Simple Stack-Based Programming Language
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As @IlCapitano says, your second
pop()may be called first:The key: the function call to c may be evaluated first, last, or between a() or b() at run time.
In response to comment:
So it depends on the compiler. Each does it differently.