]> granicus.if.org Git - re2c/commit
Topologically sort 'copy' commands.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 30 Nov 2016 23:02:25 +0000 (23:02 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 30 Nov 2016 23:02:25 +0000 (23:02 +0000)
commit7edbbca5a8114e2839af9ab6565c81cd4fa0e3b8
treeb8a82e3b3532c374fbd55566df499effddf93bd6
parent67ebe3f478ed5d73ddbb385c0f1371ca7d9f88d8
Topologically sort 'copy' commands.

The order in which copy commands are executed is important:
'x = y; y = z;' is not the same as 'y = z; x = y;' (the latter
overwrites 'y' before its precious value is copied to 'x').
To avoid overwrites, commands should be topologically sorted.
This is always possible because there's no cyclic dependencies
by construction.

Found by slyfox's fuzzer. :)
re2c/src/ir/dfa/cfg/normalize.cc
re2c/src/ir/dfa/find_state.cc
re2c/src/ir/dfa/find_state.h
re2c/src/ir/tcmd.cc
re2c/src/ir/tcmd.h
re2c/test/tags/topsort1.i--tags.c [new file with mode: 0644]
re2c/test/tags/topsort1.i--tags.re [new file with mode: 0644]
re2c/test/tags/topsort2.i--tags.c [new file with mode: 0644]
re2c/test/tags/topsort2.i--tags.re [new file with mode: 0644]