Pelles C > Bug reports

[PellesC V12RC1] fatal error: Internal error: expr2tree(#2)

(1/3) > >>

larryli:

--- Code: ---#include <stdio.h>

int main(void)
{
    struct {
        int a:8;
        int b:8;
    } c = {0};
    struct {
        int d:8;
        int e:8;
    } f[] = {{0}};
    printf("%d\n", f[c.a].d);
    return 0;
}

--- End code ---


--- Quote ---Building test.obj.
C:\Users\Larry\Projects\test12\test.c(13): fatal error: Internal error: expr2tree(#2).
*** Error code: 1 ***
Done.

--- End quote ---

Build on V11 is ok.

Pelle:
Confirmed (...and apparently not that common with a bit-field expression inside another bit-field expression).

larryli:
https://learn.microsoft.com/en-us/windows/win32/intl/determining-if-a-script-requires-glyph-shaping


--- Code: ---const SCRIPT_PROPERTIES **g_ppScriptProperties;
int g_iMaxScript;

WCHAR *pwcInChars = L"Unicode string to itemize";
int cInChars = wcslen(pwcInChars);
const int cMaxItems = 20;
SCRIPT_ITEM si[cMaxItems + 1];
SCRIPT_ITEM *pItems = si;
int cItems;

ScriptGetProperties(&g_ppScriptProperties,
                    &g_iMaxScript);

HRESULT hResult = ScriptItemize(pwcInChars,
                                cInChars,
                                cMaxItems,
                                NULL,
                                NULL,
                                pItems,
                                &cItems);
if (hResult == 0) {
    for (int i=0; i<cItems; i++) {
        if (g_ppScriptProperties[pItems[i].a.eScript]->fComplex) { // **********ERROR**********

            // Item [i] is complex script text
            // requiring glyph shaping.

        } else {

            // The text may be rendered legibly without using Uniscribe.
            // However, Uniscribe may still be used as a means of accessing
            // font typographic features.
        }
    }
} else {
    // Handle the error.
}

--- End code ---

John Z:
Hi larryLi,

It would be more helpful to use the Pelles C zip feature so that the code test can be reproduced using your exact project settings.

Posting the exact Micro$oft code snippet from their web page is not that helpful because there are many other factors.  Also what 'bug' or error code did you encounter ?  It also gives us less experienced the ability to try it without guessing what is needed to compile and help educate us as well.  For example USP10.h is required

PellesC menu item 'Project', submenu 'Zip Files', then post that.  It gives other the best chance to test using your exact case and help you, or find a bug.

Just my 2c,
John Z

TimoVJL:
full example code for testing
--- Code: ---#include <Usp10.h>
#include <wchar.h>

const SCRIPT_PROPERTIES **g_ppScriptProperties;
int g_iMaxScript;

void foo(void) {
WCHAR *pwcInChars = L"Unicode string to itemize";
int cInChars = wcslen(pwcInChars);
const int cMaxItems = 20;
SCRIPT_ITEM si[cMaxItems + 1];
SCRIPT_ITEM *pItems = si;
int cItems;

ScriptGetProperties(&g_ppScriptProperties, &g_iMaxScript);

HRESULT hResult = ScriptItemize(pwcInChars,
                                cInChars,
                                cMaxItems,
                                NULL,
                                NULL,
                                pItems,
                                &cItems);
if (hResult == 0) {
    for (int i=0; i<cItems; i++) {
        if (g_ppScriptProperties[pItems[i].a.eScript]->fComplex) { // **********ERROR**********

            // Item [i] is complex script text
            // requiring glyph shaping.

        } else {

            // The text may be rendered legibly without using Uniscribe.
            // However, Uniscribe may still be used as a means of accessing
            // font typographic features.
        }
    }
} else {
    // Handle the error.
}
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version