Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
d-m-bailey opened this issue Aug 27, 2024 · 3 comments

Comments

@d-m-bailey
Copy link

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
Copy link
Contributor

dlmiles commented Oct 6, 2024

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
Copy link
Contributor

dlmiles commented Oct 6, 2024

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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants