The closest thing you can do is to query the %{OPTFLAGS} variable so get a rough idea of the compiler flags that were used for a given RPM.
$ rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" <package>
To get the actual compiler options, however, your best bet would be to download the source RPM (SRPM) file and consult the .spec file that was used to construct it. This is the only true source where you'll find the actual compiler options that were used to build a given set of RPMs.
1. Consulting %{OPTFLAGS}
$ rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" firefox
firefox: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
How it works
You can query RPM and specify the format of the results you want the query command to return. In this case we're returning the --queryformat="%{NAME}: %{OPTFLAGS}\n which returns the name of the package along with the value for that packages %{OPTFLAGS}.
You can get a list of potential query tags like so:
$ rpm --querytags
Example
$ rpm --querytags | grep OPTFLAGS
OPTFLAGS
The tag %{OPTFLAGS} is defined as follows:
While the optflags entry doesn't play a part in determining the build or install platform, it does play a role in multi-platform package building. The optflags entry is used to define a standard set of options that can be used during the build process, specifically during compilation.
If RPM was running on an Intel 80386-compatible architecture, the optflags value would be set to -O2 -m486 -fno-strength-reduce. If, however, RPM was running on a Sun SPARC-based system, optflags would be set to -O2.
This entry sets the RPM_OPT_FLAGS environment variable, which can be used in the %prep, %build, and %install scripts.
2. Consulting SRPM
To do this you can download a given SRPM like so:
$ sudo yumdownloader --source <package name>
You can then extract the .spec file:
$ mkdir somedir; cd somedir
$ rpm2cpio ../firefox-29.0.1-1.fc19.src.rpm | cpio -ivd
The .spec file can then be consulted:
$ ls -l | grep spec
-rw-r--r--. 1 saml saml 31913 Jun 7 08:03 firefox.spec
NOTE: Even consulting the .spec file will likely be inconclusive in revealing the compiler options used, since the RPM spec macro %build can be quite cryptic in what they're actually doing, so even this approach will likely not show the compiler options.
References
yum list installed | grep squidsay?