eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
95 stars 26 forks source link

incorrect macro comparison outcome #292

Closed tksoh closed 3 years ago

tksoh commented 3 years ago

Using commit 455817323effad87929996262b6d0800cdfd6eda. Affects Windows 10 and Linux.

Run the following macro, NG says "" equals to 2:

if ("" == 2) dialog("same") else dialog("not same")

2021-01-22 17_11_43-Macro Commands

On a related topic. Somehow this would also crash Windows debug build with MSVC 2017. No issue with release build. Linux debug & release builds are not crashing either.

2021-01-22 17_00_21-Untitled

eteran commented 3 years ago

Oh, good find, i"ll investigate.

I believe the crash is Microsoft's STL debugging capabilities. So it's really a failed assertion. The assertion doesn't exist in gcc, and is "lucky" that the invalid access doesn't crash.

BTW, your bug reports have been REALLY helpful. Thanks for providing great detail on how to reproduce and the screenshots are great!

eteran commented 3 years ago

Should be fixed in master now!

tksoh commented 3 years ago

Thanks. Just thinking out loud, perhaps the macro engine requires some kind of test suite.

eteran commented 3 years ago

It probably should. The tough part is having a means to either drive a real NG instance or mock an instance enough to have good results.

But at the very least, we could have some tests that validate purely computational things!