https://bugs.winehq.org/show_bug.cgi?id=51899
--- Comment #3 from O. Nykyforchyn oleh.nyk@gmail.com --- I localized a narrow place in dlls/gdi32/dc. There is a function
DC_ATTR *get_dc_attr( HDC hdc ) { DWORD type = gdi_handle_type( hdc ); DC_ATTR *dc_attr; if ((type & 0x1f0000) != NTGDI_OBJ_DC || !(dc_attr = get_gdi_client_ptr( hdc, 0 ))) { SetLastError( ERROR_INVALID_HANDLE ); return NULL; } return dc_attr->disabled ? NULL : dc_attr; }
If the first of two OR'ed conditions is dropped:
DC_ATTR *get_dc_attr( HDC hdc ) { DWORD type = gdi_handle_type( hdc ); DC_ATTR *dc_attr;
TRACE("Got type %x\n", type);
if (!(dc_attr = get_gdi_client_ptr( hdc, 0 ))) { SetLastError( ERROR_INVALID_HANDLE ); return NULL; } return dc_attr->disabled ? NULL : dc_attr; }
then background is OK. Splitting like
DC_ATTR *get_dc_attr( HDC hdc ) { DWORD type = gdi_handle_type( hdc ); DC_ATTR *dc_attr;
if ((type & 0x1f0000) != NTGDI_OBJ_DC) { SetLastError( ERROR_INVALID_HANDLE ); return NULL; }
if (!(dc_attr = get_gdi_client_ptr( hdc, 0 ))) { SetLastError( ERROR_INVALID_HANDLE ); return NULL; } return dc_attr->disabled ? NULL : dc_attr; }
does not help. Seems like a compiler bug, maybe in oplimization or inlining.