From owner-freebsd-current@FreeBSD.ORG Mon May 28 07:34:34 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FCE816A480 for ; Mon, 28 May 2007 07:34:34 +0000 (UTC) (envelope-from Yuriy.Tsibizov@gfk.ru) Received: from mx2.gfk.ru (mx2.gfk.ru [84.21.231.139]) by mx1.freebsd.org (Postfix) with ESMTP id A53BE13C468 for ; Mon, 28 May 2007 07:34:33 +0000 (UTC) (envelope-from Yuriy.Tsibizov@gfk.ru) Received: from ex.hhp.local by mx2.gfk.ru (MDaemon PRO v9.5.6) with ESMTP id md50000106951.msg for ; Mon, 28 May 2007 11:37:22 +0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 28 May 2007 11:37:20 +0400 Message-ID: <78664C02FF341B4FAC63E561846E3BCC0A1108@ex.hhp.local> In-Reply-To: <465A7F1E.5000109@elischer.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: vrp bitfield miscompilation (WAS: [Regression] snd_emu10k1 doesn't work after GCC 4.2 upgrade) Thread-Index: Aceg92yS81lzJMzRSm6YjoHqfhqqUQAAqXxg References: <009501c79fdf$19e25880$1e00000a@hhp.local> <78664C02FF341B4FAC63E561846E3BCC0A1103@ex.hhp.local><200705280857.12035.hselasky@c2i.net> <465A7F1E.5000109@elischer.org> From: "Yuriy Tsibizov" To: "Julian Elischer" , "Hans Petter Selasky" X-Spam-Processed: mx2.gfk.ru, Mon, 28 May 2007 11:37:22 +0400 (not processed: message from valid local sender) X-MDRemoteIP: 10.0.0.30 X-Return-Path: Yuriy.Tsibizov@gfk.ru X-Envelope-From: Yuriy.Tsibizov@gfk.ru X-MDaemon-Deliver-To: freebsd-current@freebsd.org X-MDAV-Processed: mx2.gfk.ru, Mon, 28 May 2007 11:37:23 +0400 Cc: freebsd-current@freebsd.org Subject: RE: vrp bitfield miscompilation (WAS: [Regression] snd_emu10k1 doesn't work after GCC 4.2 upgrade) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2007 07:34:34 -0000 > >>> See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D32100 > >> Use of following variables _can_ be affected by above=20 > miscompilation > >> (these are signed single-bit variables): > >> > >> amd64/amd64/mp_machdep.c: int cpu_present:1; > >> amd64/amd64/mp_machdep.c: int cpu_bsp:1; > >> amd64/amd64/mp_machdep.c: int cpu_disabled:1; > >> dev/acpica/acpi_pci_link.c: int l_routed:1; > >> dev/acpica/acpi_pci_link.c: int l_isa_irq:1; > >> dev/sound/isa/ess.c: int type, duplex:1, newspeed:1; > >> dev/sound/pci/emu10k1.c: int b16:1, stereo:1, busy:1, running:1, > >> ismaster:1; > >> dev/sound/pci/solo.c: int simplex_dir, type, duplex:1, > >> newspeed:1, dmasz[2]; > >> dev/puc/puc.c: int p_hasintr:1; > >> dev/puc/puc_bfe.h: int sc_fastintr:1; > >> dev/puc/puc_bfe.h: int sc_leaving:1; > >> dev/puc/puc_bfe.h: int sc_polled:1; > >> dev/rp/rpvar.h: int rp_rts_iflow:1; > >> dev/rp/rpvar.h: int rp_disable_writes:1; > >> dev/rp/rpvar.h: int rp_cts:1; > >> dev/rp/rpvar.h: int rp_waiting:1; > >> dev/rp/rpvar.h: int rp_xmit_stopped:1; > >> dev/scc/scc_bfe.h: int m_attached:1; > >> dev/scc/scc_bfe.h: int m_fastintr:1; > >> dev/scc/scc_bfe.h: int m_hasintr:1; > >> dev/scc/scc_bfe.h: int m_probed:1; > >> dev/scc/scc_bfe.h: int m_sysdev:1; > >> dev/scc/scc_bfe.h: int ch_enabled:1; > >> dev/scc/scc_bfe.h: int ch_sysdev:1; > >> dev/scc/scc_bfe.h: int sc_fastintr:1; > >> dev/scc/scc_bfe.h: int sc_leaving:1; > >> dev/scc/scc_bfe.h: int sc_polled:1; > >> dev/uart/uart_bus.h: int sc_callout:1;=09 > /* This UART is > >> opened for callout. */ > >> dev/uart/uart_bus.h: int sc_fastintr:1;=09 > /* This UART > >> uses fast interrupts. */ > >> dev/uart/uart_bus.h: int sc_hwiflow:1;=09 > /* This UART has > >> HW input flow ctl. */ > >> dev/uart/uart_bus.h: int sc_hwoflow:1;=09 > /* This UART has > >> HW output flow ctl. */ > >> dev/uart/uart_bus.h: int sc_leaving:1;=09 > /* This UART is > >> going away. */ > >> dev/uart/uart_bus.h: int sc_opened:1;=09 > /* This UART is > >> open for business. */ > >> dev/uart/uart_bus.h: int sc_polled:1;=09 > /* This UART has > >> no interrupts. */ > >> dev/uart/uart_bus.h: int sc_txbusy:1;=09 > /* This UART is > >> transmitting. */ > >> fs/pseudofs/pseudofs_internal.h: int pvd_dead:1; > >> geom/part/g_part.h: int gpe_created:1;=09 > /* Entry is > >> newly created. */ > >> geom/part/g_part.h: int gpe_deleted:1;=09 > /* Entry has > >> been deleted. */ > >> geom/part/g_part.h: int gpe_modified:1;=09 > /* Entry has > >> been modified. */ > >> geom/part/g_part.h: int gpt_isleaf:1;=09 > /* Cannot be > >> sub-partitioned. */ > >> geom/part/g_part.h: int gpt_created:1; /* Newly > >> created. */ > >> geom/part/g_part.h: int gpt_modified:1;=09 > /* Table changes > >> have been made. */ > >> geom/part/g_part.h: int gpt_opened:1;=09 > /* Permissions > >> obtained. */ > >> i386/i386/mp_machdep.c: int cpu_present:1; > >> i386/i386/mp_machdep.c: int cpu_bsp:1; > >> i386/i386/mp_machdep.c: int cpu_disabled:1; > >> i386/include/npx.h: int fp_sgn:1; /*=20 > mantissa sign */ > >> sparc64/pci/psycho.c: int apb:1; > >> sparc64/pci/psycho.c: int ppb:1; > >> > >> I can't say that there _is_ a miscompilation related to=20 > all variables in > >> this list. > >> > >> Should most of them (I'm not shure for fp_sign) be changed=20 > to unsigned > >> int? With (signed) int these flags have values of (-1;0),=20 > with unsigned > >> int they will use more obvious (0;1) values. > >> > >> > >> Yuriy. > >=20 > > Interesting find. Another issue: > >=20 > > I've seen that the compile will round the memory size of a=20 > bit-fields down to=20 > > the nearest byte, if you turn on optimization. I think you should=20 > > use "uint8_t". >=20 > My memory is that bitfields are only defined as parts of an 'int' > in the standard and that using anything else is a gcc 'feature'. >=20 > This is a 14 year old memory (from my SCSI days) so it may not be true > now. >From ISO/IEC 9899 (C99): "A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type." Yuriy.