alsa-lib's snd_pcm_hw_params_any function causes ACCESS_VIOLATION error. Attempting to run "Starcraft II" or "World of Warcraft" game under app-emulation/wine causes the error on startup. The error appears when alsa-lib is compiled with sys-devel/gcc-4.4.5 (but not gcc-4.3.4, for example) and with both CFLAGS: * -O3 (or higher) * -march=pentium3 (or higher). Wine needs to be configured to use ALSA as a sound driver. I reproduced it with both 1.3.14 and 1.3.28 versions of wine. Reproducible: Always Steps to Reproduce: 1. gcc-config i686-pc-linux-gnu-4.4.5 && . /etc/profile 3. CFLAGS="-march=pentium3 -O3" emerge -1 media-libs/alsa-lib 4. emerge app-emulation/wine (for wine older than 1.3.25 select ALSA driver from winecfg utility, newer versions of wine should always use it) 5. Download "Starcraft II" or "World of Warcraft" game 6. run: wine Starcraft\ II.exe Actual Results: ================================================================================ StarCraft II (B19269) Time: 2011-09-17 05:43:42.510 Exe: C:\Program Files\StarCraft II\Versions\Base19132\SC2.exe Parameters: Exe Built: 2011-09-16 12:33:46.000 User: ... Computer: ... Version: 1.3.6.19269 Branch: branches/1.3.e Revision: 99450 Locale: enGB ================================================================================ ACCESS_VIOLATION (0xC0000005) occurred at 0023:F4C6421D. The memory at '0xFFFFFFFF' could not be read. -------------------------------------------------------------------------------- ---------------------------------------- Manual Stack Trace (ID:40 Stack:0x03BB0000 + 8,388,608 "Main Thread") ---------------------------------------- F4C6421D snd1_pcm_hw_refine_soft+285 F4CA0B39 snd1_pcm_direct_hw_refine+681 F4C629F7 snd_pcm_hw_refine+55 F4C6E24D snd1_pcm_generic_hw_refine+45 F4C64B66 snd1_pcm_hw_refine_slave+150 F4CA2CD7 snd_pcm_softvol_hw_refine+87 F4C629F7 snd_pcm_hw_refine+55 F4C7EC56 snd_pcm_plug_hw_refine_sprepare+214 F4C64B1B snd1_pcm_hw_refine_slave+75 F4C7F5F7 snd_pcm_plug_hw_refine+87 F4C629F7 snd_pcm_hw_refine+55 F4C5F4F2 snd_pcm_hw_params_any+50 F4D000C7 winealsa.drv AudioClient_GetMixFormat+263 (mmdevdrv.c,1374) DBG-ADDR<0FE3F054>("fmodex_4_28_08.dll") DBG-ADDR<0FE3FBE1>("fmodex_4_28_08.dll") DBG-ADDR<0FE26D8D>("fmodex_4_28_08.dll") DBG-ADDR<0FE52C3F>("fmodex_4_28_08.dll") DBG-ADDR<00F92210>("SC2.exe") DBG-ADDR<00F92C7F>("SC2.exe") DBG-ADDR<00809237>("SC2.exe") DBG-ADDR<0080A0F5>("SC2.exe") DBG-ADDR<0080A390>("SC2.exe") ---------------------------------------- DbgHelp Stack Trace (ID:40 Stack:0x03BB0000 + 8,388,608 "Main Thread") ---------------------------------------- F4C6421D snd1_pcm_hw_refine_soft+285 (7C68EF28,043AE5B0,00000000,00000000) F4CA0B39 snd1_pcm_direct_hw_refine+681 (7C68EF28,043AE5B0,043AE574,F4CA3008) F4C629F7 snd_pcm_hw_refine+55 (7C68EF28,043AE5B0,F4CC8DE0,F4CD1FF4) F4C6E24D snd1_pcm_generic_hw_refine+45 (7C693EE0,043AE5B0,043AE5B0,00000000) F4C64B66 snd1_pcm_hw_refine_slave+150 (7C693EE0,043AE8F0,F4CA2CE0,F4CA3020) F4CA2CD7 snd_pcm_softvol_hw_refine+87 (7C693EE0,043AE8F0,00000000,F4C62D11) F4C629F7 snd_pcm_hw_refine+55 (7C693EE0,043AE8F0,043AE8B4,F4C7F6B0) F4C7EC56 snd_pcm_plug_hw_refine_sprepare+214 (7C68EBA8,043AE8F0,F75295D3,043AE8F0) F4C64B1B snd1_pcm_hw_refine_slave+75 (7C68EBA8,00211BF8,F4C7F600,F4C7FD00) F4C7F5F7 snd_pcm_plug_hw_refine+87 (7C68EBA8,00211BF8,00000000,7BC362E1) F4C629F7 snd_pcm_hw_refine+55 (7C68EBA8,00211BF8,7BC4A15B,F4D15FF4) F4C5F4F2 snd_pcm_hw_params_any+50 (7C68EBA8,00211BF8,00000020,F4D0CFA7) F4D000C7 winealsa.drv AudioClient_GetMixFormat+263 (002119C0,043AEC54,0FE34A3C,0FD44D8C) (mmdevdrv.c,1374) DBG-ADDR<0FE3F054>("fmodex_4_28_08.dll") (00000000,043AECC4,043AECC0,043AECBC) DBG-ADDR<0FE3FBE1>("fmodex_4_28_08.dll") (0FD4F540,00000000,043AECC4,043AECC0) DBG-ADDR<0FE26D8D>("fmodex_4_28_08.dll") (00000000,043AEED0,00000000,00000000) DBG-ADDR<0FE52C3F>("fmodex_4_28_08.dll") (0FD44D8C,00000000,043AEED0,00000000) DBG-ADDR<00F92210>("SC2.exe") (00000001,0080884B,015BB848,00000001) DBG-ADDR<00F92C7F>("SC2.exe") (7B810000,00040022,00000001,00000000) DBG-ADDR<00809237>("SC2.exe") (01414C48,00000000,00000000,00000000) DBG-ADDR<0080A0F5>("SC2.exe") (0362FBC0,0033FD1C,7B895FF4,00000001) DBG-ADDR<0080A390>("SC2.exe") (0033FDF8,00000000,00000000,00000000) ---------------------------------------- Modules ---------------------------------------- DBG-MODULE<00800000 02F4D000 "SC2.exe" "SC2.pdb" 0 {86cc675c-3827-4995-98434ffba4df127e} 1 1311362544> DBG-MODULE<7BC10000 000B4000 "ntdll.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7B810000 0019B000 "KERNEL32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7EE40000 0012C000 "user32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7EDA0000 0008F000 "gdi32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7ED40000 0004A000 "advapi32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7EFA0000 0000A000 "version.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7EB30000 001F8000 "shell32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7EAC0000 00058000 "shlwapi.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E9C0000 000ED000 "comctl32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E9B0000 0000B000 "wsock32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E980000 00020000 "ws2_32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E950000 00020000 "iphlpapi.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E8B0000 0009E000 "msvcp80.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E7E0000 000BD000 "msvcp90.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E750000 00074000 "msvcrt.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E720000 00018000 "msvcr80.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E6F0000 0001D000 "msvcr90.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<4A800000 000ED000 "icuuc44.dll" "icuuc44.pdb" 0 {ea39ca00-13f6-4e96-84497c8564d7fafd} 1 1271192047> DBG-MODULE<4AD00000 006A7000 "icudt44.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 1271192164> DBG-MODULE<4A900000 00133000 "icuin44.dll" "icuin44.pdb" 0 {7ecdb989-61d6-48e5-a401060d3d6d3c38} 1 1271192094> DBG-MODULE<0FE00000 001D0000 "fmodex_4_28_08.dll" "fmodex_4_28_08.pdb" 0 {db72d808-eb6c-49fa-b7c08291650cc191} 1 1280257802> DBG-MODULE<7E640000 0009E000 "winmm.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E550000 000EC000 "ole32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E4D0000 00065000 "rpcrt4.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E4A0000 0001E000 "msacm32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E460000 00035000 "d3d9.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E330000 0012D000 "wined3d.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<10000000 0041A000 "d3dx9_41.dll" "d3dx9_41.pdb" 0 {92fbe774-2bab-475d-b385c3cda84ece82} 1 1235699325> DBG-MODULE<7E2F0000 00036000 "dsound.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E2D0000 00010000 "psapi.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E2B0000 0001C000 "imm32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E250000 0005A000 "ddraw.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E1E0000 00064000 "wininet.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E180000 00019000 "mpr.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7E0A0000 000D4000 "oleaut32.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7DF30000 0009A000 "winex11.drv" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<7DED0000 00032000 "uxtheme.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<F6F40000 00010000 "wlanapi.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<F6F20000 0001B000 "hnetcfg.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<F5190000 0001B000 "mmdevapi.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<F4CE0000 00039000 "winealsa.drv" "" 0 {00000000-0000-0000-0000000000000000} 0 0> DBG-MODULE<F4BC0000 00052000 "dbghelp.dll" "" 0 {00000000-0000-0000-0000000000000000} 0 0> # emerge --info Portage 2.1.10.11 (default/linux/x86/10.0/desktop, gcc-4.4.5, glibc-2.12.2-r0, 3.0.4-gentoo x86_64) ================================================================= System uname: Linux-3.0.4-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_W3520_@_2.67GHz-with-gentoo-2.0.3 Timestamp of tree: Sat, 17 Sep 2011 02:00:01 +0000 ccache version 2.4 [disabled] app-shells/bash: 4.1_p9 dev-java/java-config: 2.1.11-r3 dev-lang/python: 2.4.6, 2.5.4-r4, 2.6.6-r2, 2.7.1-r1, 3.1.3-r1 dev-util/ccache: 2.4-r9 dev-util/cmake: 2.8.4-r1 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.0.3 sys-apps/openrc: 0.8.3-r1 sys-apps/sandbox: 2.4 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.4_p6-r1, 1.5-r1, 1.6.3-r1, 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.3.4, 4.4.5 sys-devel/gcc-config: 1.4.1-r1 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 2.6.30-r1 (virtual/os-headers) sys-libs/glibc: 2.12.2 Repositories: gentoo x-portage ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1 Q3AEULA ETQW dlj-1.1 PUEL" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe -mno-tls-direct-seg-refs" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=native -O3 -pipe -mno-tls-direct-seg-refs" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs buildpkg distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j9" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X a52 aac acl acpi alsa bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt curl cxx dbus dri dts dvd dvdr emacs emboss encode esd exif fam firefox flac fortran gdbm gdu gif git gpm gtk iconv ipv6 jpeg lcms ldap libnotify mad maildir mng modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp oss pam pango pcre pdf perl png policykit ppds pppd pulseaudio python qt3support qt4 readline reiserfs ruby sdl session spell ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb vdpau vim vim-syntax vorbis win32codecs x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
The bug can be worked-around quite easily, for example by replacing -O3 with -O2 CFLAG for alsa-lib. Add the following to /etc/portage/env/media-libs/alsa-lib: CFLAGS=$(echo $CFLAGS | sed -s 's/-O *[0-9]\+/-O2/g')
Contrary to what uname output could suggest here, user-land part of my system is x86 and the bug should be reproducible on x86 architecture. The only x86_64 part is the kernel which shouldn't be relevant since the bug does not appear to be in kernel.
If you see this still with current stable gcc (like 4.6, 4.7, 4.8) and alsa-lib-1.0.27, please let us know No reason to keep this open without update from the reporter -> Closing