public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Why is (2 < 2) true? Is it a gcc bug?
@ 2014-01-17 13:37 Dorau, Lukasz
  2014-01-17 13:55 ` Dorau, Lukasz
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Dorau, Lukasz @ 2014-01-17 13:37 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org

Hi

My story is very simply...
I applied the following patch:

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -698,8 +698,11 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (err)
 		goto err_host_alloc;
 
-	for_each_isci_host(i, isci_host, pdev)
+	for_each_isci_host(i, isci_host, pdev) {
+		pr_err("(%d < %d) == %d\n",\
+		       i, SCI_MAX_CONTROLLERS, (i < SCI_MAX_CONTROLLERS));
 		scsi_scan_host(to_shost(isci_host));
+	}
 
 	return 0;
 
-- 
1.8.3.1

Then I issued the command 'modprobe isci' on platform with two SCU controllers (Patsburg D or T chipset)
and received the following, very strange, output:

(0 < 2) == 1
(1 < 2) == 1
(2 < 2) == 1

Can anyone explain why (2 < 2) is true? Is it a gcc bug?

(The kernel was compiled using gcc version 4.8.2.)

Lukasz


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-01-20 19:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 13:37 Why is (2 < 2) true? Is it a gcc bug? Dorau, Lukasz
2014-01-17 13:55 ` Dorau, Lukasz
2014-01-17 16:40   ` Sebastian Riemer
2014-01-17 17:00     ` Dorau, Lukasz
2014-01-17 13:58 ` Richard Weinberger
2014-01-17 14:55   ` Dorau, Lukasz
2014-01-17 17:58 ` Alexei Starovoitov
2014-01-17 19:58   ` Alexei Starovoitov
2014-01-17 20:27     ` Andi Kleen
2014-01-17 21:02     ` Markus Trippelsdorf
2014-01-17 21:43       ` Alexei Starovoitov
2014-01-18 11:31         ` Dorau, Lukasz
2014-01-20 19:43           ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox