However if I change the .OnInit function content to the following, it works. Anybody knows why?
outfile `test.exe`
!include 'MUI.nsh'
!include 'LogicLib.nsh'
!define LOGICLIB_SECTIONCMP
!insertmacro MUI_PAGE_COMPONENTS
SectionGroup '!Parent' pnt
Section '!aaaa' aa
SectionEnd
Section '!bbbb' bb
SectionEnd
Section '!cccc' cc
SectionEnd
SectionGroupEnd
Function .OnInit
${For} $0 ${aa} ${cc}
!insertmacro UnSelectSection $0
${Next}
FunctionEnd
Function .OnInit
!insertmacro UnSelectSection ${aa}
!insertmacro UnSelectSection ${bb}
!insertmacro UnSelectSection ${cc}
FunctionEnd