Bug 24125 - Assertion failure with embedded NULs in string
Summary: Assertion failure with embedded NULs in string
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.31
: P2 normal
Target Milestone: 2.33
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-23 07:46 UTC by Christer Solskogen
Modified: 2019-01-25 01:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-01-24 00:00:00


Attachments
working .S file (287 bytes, text/plain)
2019-01-23 07:46 UTC, Christer Solskogen
Details
not working .S file (287 bytes, text/plain)
2019-01-23 07:47 UTC, Christer Solskogen
Details
not working .S file (295 bytes, text/plain)
2019-01-24 06:00 UTC, Christer Solskogen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christer Solskogen 2019-01-23 07:46:22 UTC
Created attachment 11563 [details]
working .S file

If mingw-w64 is configured with --enable-experimental, a crossed gcc compiler (--build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32) cannot compile due to gas:

/home/builder/binutils-2.31.1/gas/read.c:5366

(If mingw-w64-crt is configured without --enable-experimental, everything works just fine)

I've attached two .S files. One where crt is configured without --enable-experimental, and one where is it enabled.
Comment 1 Christer Solskogen 2019-01-23 07:47:02 UTC
Created attachment 11564 [details]
not working .S file
Comment 2 Alan Modra 2019-01-24 05:10:36 UTC
You attached the same file twice.
Comment 3 Christer Solskogen 2019-01-24 06:00:45 UTC
Created attachment 11566 [details]
not working .S file
Comment 4 Alan Modra 2019-01-24 08:34:35 UTC
Part of hexdump -c display of good file.

0000060  \t   .   a   s   c   i   i       "   H   e   l   l   o       w
0000070   o   r   l   d   !   \   0   "  \r  \n  \t   .   t   e   x   t

The same in the bad file.

0000060  \t   .   a   s   c   i   i       "   H   e   l   l   o       w
0000070   o   r   l   d   !   \  \0   "  \r  \n  \t   .   t   e   x   t

The difference is that the bad file has an embedded NUL in the source.  That's a bug in your gcc, but gas shouldn't give an internal error on user input, so it's a bug in gas too.
Comment 5 Christer Solskogen 2019-01-24 09:51:38 UTC
A bug in GCC triggered by a setting in mingw-w64-crt :/
Comment 6 cvs-commit@gcc.gnu.org 2019-01-24 23:15:21 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0c56b5cfb68cd099e00f6fdb5ad08061c7b16b79

commit 0c56b5cfb68cd099e00f6fdb5ad08061c7b16b79
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jan 25 09:34:14 2019 +1030

    PR24125, Assertion failure with embedded NULs in string
    
    An assertion that can be triggered by user input is wrong, so remove
    it.  I believe the NUL would have been accepted before the PR20902
    patch.
    
    	PR 20902
    	PR 24125
    	* read.c (stringer): Delete assertion.
Comment 7 Alan Modra 2019-01-25 01:35:48 UTC
Fixed.