From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id BB53C3858005; Wed, 1 Mar 2023 04:01:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB53C3858005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] gas s_fill caused internal error in frag_new X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 0eb3224b35d94576e0498eed51373f52dee71bf1 X-Git-Newrev: d09f4d4a9b96dcb4b732fe13549506be5b276ec2 Message-Id: <20230301040103.BB53C3858005@sourceware.org> Date: Wed, 1 Mar 2023 04:01:03 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2023 04:01:03 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd09f4d4a9b96= dcb4b732fe13549506be5b276ec2 commit d09f4d4a9b96dcb4b732fe13549506be5b276ec2 Author: Alan Modra Date: Wed Mar 1 12:50:34 2023 +1030 gas s_fill caused internal error in frag_new =20 Fix an internal error after "non-constant fill count for absolute section". =20 * read.c (s_fill): Don't create frags after errors. Diff: --- gas/read.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/gas/read.c b/gas/read.c index d43584be28c..5d83d35e0aa 100644 --- a/gas/read.c +++ b/gas/read.c @@ -2201,22 +2201,32 @@ s_fill (int ignore ATTRIBUTE_UNUSED) as_warn (_("repeat < 0; .fill ignored")); size =3D 0; } - - if (size && !need_pass_2) + else if (size && !need_pass_2) { - if (now_seg =3D=3D absolute_section) + if (now_seg =3D=3D absolute_section && rep_exp.X_op !=3D O_constant) { - if (rep_exp.X_op !=3D O_constant) - as_bad (_("non-constant fill count for absolute section")); - else if (fill && rep_exp.X_add_number !=3D 0) - as_bad (_("attempt to fill absolute section with non-zero value")); - abs_section_offset +=3D rep_exp.X_add_number * size; + as_bad (_("non-constant fill count for absolute section")); + size =3D 0; + } + else if (now_seg =3D=3D absolute_section && fill && rep_exp.X_add_nu= mber !=3D 0) + { + as_bad (_("attempt to fill absolute section with non-zero value")); + size =3D 0; } else if (fill && (rep_exp.X_op !=3D O_constant || rep_exp.X_add_number !=3D 0) && in_bss ()) - as_bad (_("attempt to fill section `%s' with non-zero value"), - segment_name (now_seg)); + { + as_bad (_("attempt to fill section `%s' with non-zero value"), + segment_name (now_seg)); + size =3D 0; + } + } + + if (size && !need_pass_2) + { + if (now_seg =3D=3D absolute_section) + abs_section_offset +=3D rep_exp.X_add_number * size; =20 if (rep_exp.X_op =3D=3D O_constant) {