NO

Author Topic: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)  (Read 3289 times)

Offline larryli

  • Member
  • *
  • Posts: 11
[PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« on: April 07, 2023, 11:55:29 AM »
Code: [Select]
#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;
}

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

Build on V11 is ok.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #1 on: April 16, 2023, 05:14:45 PM »
Confirmed (...and apparently not that common with a bit-field expression inside another bit-field expression).
/Pelle

Offline larryli

  • Member
  • *
  • Posts: 11
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #2 on: April 17, 2023, 09:00:22 AM »
https://learn.microsoft.com/en-us/windows/win32/intl/determining-if-a-script-requires-glyph-shaping

Code: [Select]
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.
}


Offline John Z

  • Member
  • *
  • Posts: 865
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #3 on: April 17, 2023, 11:59:37 AM »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2122
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #4 on: April 17, 2023, 12:02:05 PM »
full example code for testing
Code: [Select]
#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.
}
}
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #5 on: April 17, 2023, 02:45:18 PM »
https://learn.microsoft.com/en-us/windows/win32/intl/determining-if-a-script-requires-glyph-shaping

Code: [Select]
    ......
    for (int i=0; i<cItems; i++) {
        if (g_ppScriptProperties[pItems[i].a.eScript]->fComplex) { // **********ERROR**********
    ......
Simply shows that the use of a bit-field expression inside another bit-field expression is used in MS software.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 865
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #6 on: April 18, 2023, 12:19:37 AM »
OH --- I thought is was another (new) bug example..  Need more verbosity  ;D

Thanks, got it.

John Z

Offline larryli

  • Member
  • *
  • Posts: 11
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #7 on: April 19, 2023, 03:06:29 AM »
I am sorry.  :-X

Just about why I found this bug...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2122
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #8 on: April 19, 2023, 11:06:27 AM »
@larryli
Don't sorry, also standard headers was tested at same time.
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 865
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #9 on: April 19, 2023, 12:13:53 PM »
I am sorry.  :-X

larryli - please don't be sorry, you didn't do anything wrong at all.  My sincere apologies to you if my posts sounded that way.
The more experienced folks obviously understood your posts ;)

Keep testing and keep posting! Above all no "lip sealing"!  :)

John Z
« Last Edit: April 19, 2023, 12:21:08 PM by John Z »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: [PellesC V12RC1] fatal error: Internal error: expr2tree(#2)
« Reply #10 on: April 19, 2023, 04:45:25 PM »
I am sorry.  :-X

Just about why I found this bug...
Good job!
Go on please!  ;)
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide