RTimothyEdwards / magic

Magic VLSI Layout Tool
Other
484 stars 101 forks source link

-O2 compilation causes the Match function in utils/Match.c to match partial string. #322

Open d-m-bailey opened 1 month ago

d-m-bailey commented 1 month ago

This issue is just for informational purposes.

Compiling with -O2 optimization causes the pattern string to match any string beginning with the pattern string. astring will match astring_and_anything_else.

Don't use -O2.

dlmiles commented 1 week ago

Unable to reproduce.

Tried with gcc v8.5.0 and v13.2.0 and v14.0.1

Please advise the platform, distribution (/etc/os-release) and compiler (gcc -v) details.

dlmiles commented 1 week ago

match_main.c.txt

Here is a C standalone file attached as TXT file to github.

checkout magic project, then configure magic project then build magic project (this step maybe optional) place match_main.c in the top level folder then use command line at of file to compile testcase then run testcase

note this testcase hits all branch paths inside Match() the profile report command sequence is listed at the top of the file to confirm this

please edit test case to demonstrate the claim in this bug report and report platform details when found

d-m-bailey commented 1 week ago

@dlmiles Well, I can't get it to work (by work I mean fail) with the snippet of code you provided. I'll see if I can recreate the problem with the original program.