[Chapel Merge] Don't always add -O3 to flags when compiling with

Branch: refs/heads/main
Revision: 9838af6
Author: mppf
Link: Unavailable
Log Message:

Merge pull request #18978 from mppf/follow-18880-gasnet-O3

Don't always add -O3 to flags when compiling with gasnet

Follow-up to PR #18880.

The pkg-config .pc file we get gasnet flags from includes -O3 in the
flags, which caused a failure for the test

test/expressions/bradc/uminusVsTimesPrec.chpl

(which is sensitive to optimization level and skipped with --fast).

As well as failures with CHPL_UNWIND testing.

Previously the Makefile based approach avoided the -O3 by getting
only particular kinds of flags. We could do that too with the pkg-config
parsing as well but for now, just filter out the flags we don't want
after we parse them.

Reviewed by @ben-albrecht - thanks!