Bug 43041 - Default WCEM for opened files is always WCEM_Brackets instead of the -gnatW-specified encoding
Summary: Default WCEM for opened files is always WCEM_Brackets instead of the -gnatW-s...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-11 17:50 UTC by Maximilian Marx
Modified: 2015-12-06 09:23 UTC (History)
2 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2015-12-06 00:00:00


Attachments
Expected Output (196 bytes, text/plain)
2010-02-11 17:51 UTC, Maximilian Marx
Details
Constraint_Error because the file is opened with bracket coding (199 bytes, text/plain)
2010-02-11 17:52 UTC, Maximilian Marx
Details
Test file (17 bytes, text/plain)
2010-02-11 17:52 UTC, Maximilian Marx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maximilian Marx 2010-02-11 17:50:17 UTC
The GNAT Reference Manual (8.6) specifies: `The default encoding method for the standard files, and for opened files for which no WCEM parameter is given in the FORM string matches the wide character encoding specified for the main program (the default being brackets encoding if no coding method was specified with -gnatW).'

However, if an empty FORM string is given to Open or Create, the WCEM is always set to brackets coding, regardless of the encoding method that has been specified with -gnatW:

Set_WCEM (a-witeio.adb:1632):
`if Start = 0 then
  File.WC_Method := WCEM_Brackets;
else'


from `gcc -v':
`Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.3-2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
gcc version 4.4.3 (Debian 4.4.3-2)'
Comment 1 Maximilian Marx 2010-02-11 17:51:31 UTC
Created attachment 19845 [details]
Expected Output

% gnatmake -f -gnatW8 u8                                           
gcc-4.4 -c -gnatW8 u8.adb                            
gnatbind -x u8.ali
gnatlink u8.ali
% ./u8
`[הצ�]'
%
Comment 2 Maximilian Marx 2010-02-11 17:52:33 UTC
Created attachment 19846 [details]
Constraint_Error because the file is opened with bracket coding

% gnatmake -f -gnatW8 u8_fail
gcc-4.4 -c -gnatW8 u8_fail.adb
gnatbind -x u8_fail.ali
gnatlink u8_fail.ali
% ./u8-fail 

raised CONSTRAINT_ERROR : s-wchcnv.adb:209 explicit raise
%
Comment 3 Maximilian Marx 2010-02-11 17:52:58 UTC
Created attachment 19847 [details]
Test file

The test file used to demonstrate the issue.
Comment 4 Eric Botcazou 2015-12-06 09:23:10 UTC
Still fails on mainline.