Consider the following analysis ( rev and irrev respectively refer to a reversible and an irreversible path, between the same initial and final states):
$dU_{rev}=dq_{rev}+dw_{rev}$,and,$dU_{irrev}=dq_{irrev}+dw_{irrev}$.
$dU_{rev}=dU_{irrev}$. Therefore, $dq_{rev}+dw_{rev}=dq_{irrev}+dw_{irrev}$. Rearranging,
$$dq_{irrev}-dq_{rev}=dw_{rev}-dw_{irrev}\tag{E01}$$
Now: If the volume increases, then $dw_{rev}$ and $dw_{irrev}$ are negative: with $|dw_{rev}|>|dw_{irrev}|$. Thus $dw_{rev}-dw_{irrev}<0$.
On the other hand, if the volume decreases, then $dw_{rev}$ and $dw_{irrev}$ are positive: with $|dw_{rev}|<|dw_{irrev}|$. Thus, again, $dw_{rev}-dw_{irrev}<0$.
We can thus conclude, in general, $dw_{rev}-dw_{irrev}<0$. E01 thus becomes:
$$dq_{irrev}-dq_{rev}<0\tag{E02}$$
Now the Gibbs free energy (G) is defined as $G=H-TS$. Thus, $dG=dH-TdS-SdT$. At constant pressure and Temperature, $dH=dq$ and $dT=0$. Thus, $$dG=dq-TdS= dq-T(dq_{rev}/T)=dq-dq_{rev}\tag{E03}$$
If the process is reversible , then E03 becomes $dG=0$. If the process is irreversible, E02 implies $dG<0$. Combining these together, we get $dG \leq0$.
This analysis ensures that $dG$ is never positive...... Which seems to suggest that (if we take $dG$ as the criteria for spontaneity) every process is spontaneous.
The logical conclusion is that there's something in my analysis that isnt general: it holds for spontaneous processes only. What is it? Is it that the first-law requires some modification to be general?