From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YLzL6-0003m6-Rm for mharc-grub-devel@gnu.org; Thu, 12 Feb 2015 14:22:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLzL0-0003lP-26 for grub-devel@gnu.org; Thu, 12 Feb 2015 14:22:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLzKv-0001BU-73 for grub-devel@gnu.org; Thu, 12 Feb 2015 14:22:10 -0500 Received: from mail-la0-f42.google.com ([209.85.215.42]:42977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLzKu-0001BG-Vw for grub-devel@gnu.org; Thu, 12 Feb 2015 14:22:05 -0500 Received: by labgf13 with SMTP id gf13so12206726lab.9 for ; Thu, 12 Feb 2015 11:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=KAG6M4h4ra+GTHgxiqDNH5qG/dYiPmG7rLWaDv5kVUk=; b=rspJqai8J1QuqwEbvUcOJZNLz5q4HCF+xJ3x/fCRFc56loCAoUHG4ppHENh+1F18jD EdutjZosALIOQXXlqQAq/gYGew9bYnyFxqbt98U2j+UAs4r7xszzKnPJkcLJFQ5yi0Yq jhLyb8BawDJ9I2EaiafAyXyeSBDytFcCK1n4JLtEd1Yv2TP8TI4XyNpFVvbwMZicdAvi fizeQEzI3t/FtizsXhTZuTzHVbca1mBsyOx1dWQ+SdLtkWGkM42SUEm8dVDMZnNoWzKI SUikMIv09ecOoaqhfZxDoqMBwKE/rjUs1zMSSLLMjSsruCXO5iBvR0vlco1rmDWlYUvw Lv8g== X-Received: by 10.152.42.169 with SMTP id p9mr4591138lal.91.1423768923982; Thu, 12 Feb 2015 11:22:03 -0800 (PST) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id zr10sm932651lbb.38.2015.02.12.11.22.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 11:22:02 -0800 (PST) Date: Thu, 12 Feb 2015 22:22:00 +0300 From: Andrei Borzenkov To: Jiri Slaby Subject: Re: [PATCH] util: mkimage, fix gcc5 build failure Message-ID: <20150212222200.5d24d1b5@opensuse.site> In-Reply-To: <1423735329-24760-1-git-send-email-jslaby@suse.cz> References: <1423735329-24760-1-git-send-email-jslaby@suse.cz> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.42 Cc: grub-devel@gnu.org, phcoder@gmail.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 19:22:15 -0000 pushed =D0=92 Thu, 12 Feb 2015 11:02:09 +0100 Jiri Slaby =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > gcc5 reports: > ../util/mkimage.c: In function 'grub_install_get_image_target': > ../util/mkimage.c:954:5: error: loop exit may only be reached after undef= ined behavior [-Werror=3Daggressive-loop-optimizations] > && j < ARRAY_SIZE (image_targets[i].names); j++) > ^ > ../util/mkimage.c:953:39: note: possible undefined statement is here > for (j =3D 0; image_targets[i].names[j] > ^ >=20 > Well, let's move the index 'j' test before accesing the array to: > 1) make the loop obvious > 2) make gcc happy >=20 > Signed-off-by: Jiri Slaby > --- > util/mkimage.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/util/mkimage.c b/util/mkimage.c > index bccd70388afa..7821dc5eaf11 100644 > --- a/util/mkimage.c > +++ b/util/mkimage.c > @@ -937,8 +937,8 @@ grub_install_get_image_target (const char *arg) > { > unsigned i, j; > for (i =3D 0; i < ARRAY_SIZE (image_targets); i++) > - for (j =3D 0; image_targets[i].names[j] > - && j < ARRAY_SIZE (image_targets[i].names); j++) > + for (j =3D 0; j < ARRAY_SIZE (image_targets[i].names) && > + image_targets[i].names[j]; j++) > if (strcmp (arg, image_targets[i].names[j]) =3D=3D 0) > return &image_targets[i]; > return NULL;