| Anonymous | Login | Signup for a new account | 2013-05-25 03:37 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0016219 | FPC | Compiler | public | 2010-04-07 07:44 | 2010-11-16 16:57 | ||||
| Reporter | Thierry Coq | ||||||||
| Assigned To | Jonas Maebe | ||||||||
| Priority | normal | Severity | major | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | i386 | OS | Windows | OS Version | XP | ||||
| Product Version | 2.4.1 | Product Build | 24077 | ||||||
| Target Version | Fixed in Version | 2.6.0 | |||||||
| Summary | 0016219: String in const array of string does not compile | ||||||||
| Description | The following piece of code results in a compiler abort with the following message: Fatal: Compilation aborted. const aStrArray: array [0..0] of String = ( #$ffff' ' ); The same string in a const, without the array, compiles: const aStrArray: #$ffff' '; If the $ffff is the last part of the string, it compiles? | ||||||||
| Steps To Reproduce | Take the piece of code above and put it in a simple program. Compile. The compilation will abort. A Lazarus project reproducing the problem is attached. | ||||||||
| Additional Information | This was also tested as a bug on 2.3.1. However in Linux, I was unable to reproduce the bug (FPC 2.4.0, Build 22279, 25-10-2009). A work-around for me that worked was to declare a (long) list of string constants, each with a different name. | ||||||||
| Tags | No tags attached. | ||||||||
| FPCOldBugId | |||||||||
| Fixed in Revision | 15240 | ||||||||
| Attached Files | |||||||||
Relationships |
||||||
|
||||||
Notes |
|
|
(0036514) Bart Broersma (reporter) 2010-04-07 11:58 |
fpc 2.4.1 / Win9x With {$H-} when compiling I get a warning: strarray.pp(9,3) Warning: string "`~Z" is longer than "255" writeln('>',aStrArray[0],'<') gives: >`~Z # ,Á_ P \q? ü £pDîZ <¦_ P Ó)< ¦_ ü < If you declare const aStrArray: #$ffff' '; no such warning is shown and writeln('>',aStr,'<') gives >? < With {$H+} compiling fails and the compiler crashes: Free Pascal Compiler version 2.4.1 [2010/03/12] for i386 Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Win32 for i386 Compiling strarray.pp Fatal: Compilation aborted An unhandled exception occurred at $00402142 : EAccessViolation : Access violation $00402142 $004E2C33 $004E2C43 $004C95AA $004C5424 $004C2553 $004C492F $0042E324 $0041117C $004017E6 Declaring a string as having #$FFFF in it, to me looks as if it is supposed to be a WideString, and #$FFFF being a WideChar? Declaring the array as array[0..0] of WideString resolves the issue. Fpc should however not crash on compiling if it is declared as array[0..0] of string. |
|
(0037359) Jonas Maebe (manager) 2010-05-08 13:02 |
The compiler now gives an error if you try to declare a short/ansistring typed constant containing wide/unicode strings. The reason is that the compiler cannot convert a wide/unicode string into an ansi/shortstring at compile-time, since it does not know what the ansi encoding will be when the program is executed (and this ansi encoding can even be different every time it is executed). Kylix does compile the example program, but it converts the #$ffff into #$ff#$20, which I think makes no sense and is a bug in Kylix. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2010-04-07 07:44 | Thierry Coq | New Issue | |
| 2010-04-07 07:44 | Thierry Coq | File Added: BugConstStringArray.zip | |
| 2010-04-07 11:58 | Bart Broersma | Note Added: 0036514 | |
| 2010-05-08 13:02 | Jonas Maebe | Fixed in Revision | => 15240 |
| 2010-05-08 13:02 | Jonas Maebe | Status | new => resolved |
| 2010-05-08 13:02 | Jonas Maebe | Fixed in Version | => 2.5.1 |
| 2010-05-08 13:02 | Jonas Maebe | Resolution | open => fixed |
| 2010-05-08 13:02 | Jonas Maebe | Assigned To | => Jonas Maebe |
| 2010-05-08 13:02 | Jonas Maebe | Note Added: 0037359 | |
| 2010-11-16 16:57 | Jonas Maebe | Status | resolved => closed |
| 2010-12-02 23:58 | Jonas Maebe | Relationship added | has duplicate 0018140 |
| Main | My View | View Issues | Change Log | Roadmap |



